if (dr.Read() == true)
{
textBox2.Text= dr.GetSqlValue(0).ToString();
}
i am try like this string value to double but i got error.......
label5.Text = Convert.ToDouble(textBox2.Text);
please give me ans
how to convert string value to double......
Loading
sriPosted Oct 14, 2012, 11:39 AM
it is working......
VulpesPosted Oct 14, 2012, 10:41 AM
sriPosted Oct 14, 2012, 10:38 AM
the string value can't be stored in the table..
VulpesPosted Oct 14, 2012, 9:48 AM
label5.Text = textBox2.Text;
Incidentally, to convert what's in the textbox to a double in a fool-proof way. I'd use:
double d;
bool isValid = Double.TryParse(textBox2.Text, out d);
if (!isValid)
{
MessageBox.Show("Not a valid number. Please amend");
textBox2.Focus();
return;
}
// do something with 'd'