|
Um...Well, one bit is almost right!
Don't use Parse - I did say to look at int.TryParse
The reason being, users make mistakes. If I type "hello" in your textbox, your app will crash - you should tell me off! TryParse is similar to Parse, but it returns a true/false value for "it worked/it failed" - which lets you work on without crashing.
Try it: the MSDN documentation is pretty clear!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
private void button1_Click_1(object sender, EventArgs e)
{
{
num = int.Parse(txtorder.Text);
for (int flag = 0; flag == num; flag++)
{
if (flag == 4)
{
itemcode.Enabled = true;
txtquantity.Enabled = true;
}
else
{
itemcode.Enabled = false;
txtquantity.Enabled = false;
}
}
}
int.TryParse is not working in my C# and we didn't even use that in our school
|
|
|
|
|
Andrei Ang wrote: we didn't even use that in our school Which school?
What does "not work" mean? Does it ignore the line, does it not run and complain, does it explode?
Int32 theNumber = 0;
if (!Int32.TryParse("hello", out theNumber))
{
MessageBox.Show("User error: replace user with one that can enter a number and try again.");
}
else
{
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Andrei Ang wrote: we didn't even use that in our school
Then you should!
Did you look at the MSDN documentation for int.TryParse? It's there to help you, explains what it does, and generally speaking gives example code...
And did you think too much about what a for loop will do inside a button click event?
Come on, stop guessing, and start thinking! It's a much, much easier and quicker way to do things in the long run!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
http://i24.photobucket.com/albums/c2/Angdrei/2_zpslvbn8o1v.jpg
this one is one of my form. The name in textboxes are the names of the textbox.
For example I want to input "3" in txtorder.
Therefore, I could only input 3 times in the txtquantity & itemcode textboxes.
|
|
|
|
|
I suggest you work through http://www.charlespetzold.com/dotnet/[^]. You will learn C# much faster than guessing and posting questions here. Most of what you are asking is simple logic, not specific to any programming language, so that is what you need to grasp first.
|
|
|
|
|
Sir Hear Is My Code
Actually Sir I have 6 Combobox and 12 text box and two Image Buttons
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EmployeeFunction.DAL;
namespace MUP.hr
{
public partial class frmemp : System.Web.UI.Page
{
Newemployee objQuerySatus = new Newemployee();
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
Displaydesignation();
Displaydepartment();
}
}
catch (Exception ex)
{
lblMsg.Visible = true;
lblMsg.Text = ex.Message;
}
}
public void Displaydesignation()
{
DataSet dsStatus = objQuerySatus.Displaydesignation();
Session["Query"] = dsStatus;
if (dsStatus.Tables[0].Rows.Count > 0)
{
cmbdesig.Items.Add("Select");
cmbdesig.DataTextField = "desig_name";
cmbdesig.DataValueField = "desig_name";
cmbdesig.DataSource = dsStatus;
cmbdesig.DataBind();
}
}
public void Displaydepartment()
{
DataSet dsStatus = objQuerySatus.Displaydepartment();
Session["Query"] = dsStatus;
if (dsStatus.Tables[0].Rows.Count > 0)
{
cmbdept.Items.Add("Select");
cmbdept.DataTextField = "DEPT_NAME";
cmbdept.DataValueField = "DEPT_NAME";
cmbdept.DataSource = dsStatus;
cmbdept.DataBind();
//cmbdesig.DataSource = dsStatus.Tables[0];
//cmbdesig.DataBind();
}
}
protected void CMBQUALI_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void CMBGENDER_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void CMBMARRIED_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void CMBRELIGN_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void dbd_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void dbm_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void dby_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void CMBIDPRF_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void cmbdept_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void cmbdesig_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void DropDownList7_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void CMBTYPE_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void CMBGRADE_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void djy_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void djm_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void djd_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
{
}
}
}
|
|
|
|
|
And what part of that code do you think might be relevant?
For starters, when you post code fragments, use a code block properly:
This text describes the problem.
<pre lang="cs">This is the code fragment</pre>
And you end up with:
Sir Hear Is My Code
Actually Sir I have 6 Combobox and 12 text box and two Image Buttons
using EmployeeFunction.DAL;
namespace MUP.hr
{
public partial class frmemp : System.Web.UI.Page
{
Newemployee objQuerySatus = new Newemployee();
protected void Page_Load(object sender, EventArgs e)
{
But...the important things are:
1) Don't just dump it on us. Commented out code is useless, as are empty methods. So remove them!
2) Then show us the relevant code fragment to your problem. You aren't: none of that code has anything obvious to do with HTTP addresses, much less "long ones".
So check that you have the right file - because that one probably isn't it.
Help us to help you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi all,
How to draw the radar display in Cartesian coordinates and spherical coordinate. Two display is synchronous together.
Thanks
|
|
|
|
|
|
Hi all.
I want to get send bytes and receive bytes for all process and application are running.
Anyone can tell me what CategoryName, CounterName and instance I have to choose.
|
|
|
|
|
As explained in Network-Related Performance Counters[^] you can find the amount of sent and received bytes from the Network Interface group. This is a total amount for all processes so as far as I know you can't see process specific information.
The instance you need to select is the network interface you want to monitor. If you have several network interfaces, you can have a look at the Task Manager to see which ones are active.
|
|
|
|
|
Thank for your reply.
But I want to see the amount of sent and received bytes process specific information. not from the Network Interface group.
|
|
|
|
|
|
The site does not seem to support that. I suggest you contact the sites' owner and request the feature if you need it.
Otherwise, you'd have to explain what you are trying to achieve.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
MailMessage mail = new MailMessage();
try
{
SmtpClient smtp = new SmtpClient();
System.Net.NetworkCredential nc = new System.Net.NetworkCredential("[DELETED]@gmail.com", "[DELETED]");
smtp.Port = 587;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = nc;
mail.To.Add("shreeraje2345@gmail.com");
mail.From = new MailAddress(txtEmail.Text);
mail.Subject = txtName.Text;
string body = "From: " + txtName.Text + "\n";
body += "Email: " + txtEmail.Text + "\n";
body += "Applied For Job ID: " + lblJobId.Text + "\n";
body += "Applied For Job Position: " + lblJobName.Text + "\n";
body += "DOB:" + txtDOB.Text + "\n";
body += "Qualification:" + dllQualifn.SelectedItem.Text + "\n";
body += "Specialization:" + dllSpcialn.SelectedItem.Text + "\n";
body += "Address:" + txtAddress.Text + "\n";
body += "Pincode:" + txtPincode.Text + "\n";
body += "State:" + txtState.Text + "\n";
body += "City:" + txtCity.Text + "\n";
body += "Wheather Experience:" + dllW_Exp.SelectedItem.Text + "\n";
body += "Years Of Experience:" + txtY_Exp.Text + "\n";
body += "Verification Code:" + txtCaptcha.Text + "\n";
mail.Body = body;
mail.Attachments.Add(new Attachment(PhotoUpload.FileContent, System.IO.Path.GetFileName(PhotoUpload.FileName)));
mail.Attachments.Add(new Attachment(ResumeUpload.FileContent, System.IO.Path.GetFileName(ResumeUpload.FileName)));
smtp.Send(mail);
lblMessage.Text = "Your Application has been send sucessfully";
work on local host but not work when i use on godadday host
[edit]Email details removed, Code block added - OriginalGriff[/edit]
modified 20-Aug-15 3:40am.
|
|
|
|
|
You have left your email address and the password visible in your code!
|
|
|
|
|
Never post your email address in any forum, unless you really like spam!
And posting it with your password as well? Frankly, that's just plain stupid!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
|
You should consider using their own SMTP service. Most of the users here (using GoDaddy services) have complained and raised issues in which they are not able to send emails when their applications are hosted on GoDaddy.
I would recommend that you (first of all) contact the administrator (perhaps in the company he will be a customer services manager or operator), since we do not respond on their behalf it is hard to tell what you should consider doing in your case of application. Indeed the code you show works (as stated in the post itself). The problem will be with the services being provided to you, maybe your application isn't provided with the feature for sending emails at all, or to communicate with SMTP servers etc.
http://forums.asp.net/post/5825785.aspx[^]
https://pk.godaddy.com/help/workspace-email[^]
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Sir I Have found this please help how to remove it
Server Error in '/' Application.
HTTP Error 400 - Bad Request.
|
|
|
|
|
|
We can't even begin to suggest a solution to that.
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
And that is just so broad a "question" that it could be any one of a million possible causes that generates the error. And we don't have any access to your code, your site, your data - so we have no idea at all what to suggest.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
404 Error - answer not found
|
|
|
|