What the equivalent of the Val (VB.Net) function in C#
Hi,
I am trying to do multiplication of the two double number from the textbox.
It is giving me FormatException for the blank textbox and if the textbox is having purely string value.
Code is like this
double temp = double.Parse(txtLI_JobsAffected3.Text) * double.Parse(txtLI_Impact3.Text);
txtLI_Total3.Text = System.Convert.ToString(temp);
Can anybody tell me how to deal with this?
I am new to C#.
Anyhelp will be appreciated.
Thanks :wave:
Amit
Re: What the equivalent of the Val (VB.Net) function in C#
try this:
double temp;
try
{
temp = double.Parse(textBox1.Text) * double.Parse(textBox2.Text);
textBox3.Text = temp.ToString();
}
catch
{
textBox3.Text = "fields empty or input is not_a_number";
}
(sorry for plain text)
take care :)
\me is new too :)