I have an error message when I type a number in a textbox to give it a format. when I'm typing with this code :
private void textBoxX1_TextChanged(object sender, EventArgs e)
{
textBoxX1.Text = string.Format("{0:F}",double.Parse(textBoxX1.Text));
string txtval = textBoxX1.Text;
}
I only want two decimals for formatting so if I type 100
the textbox format it to 100.00
. and then passes that value to the variable txtval
but give me this error:
Input string was not in a correct format.