Possible Duplicate:
Error message during calculation
int totalValue = 0;
totalValue = int.Parse(Label9.Text) * int.Parse(Label6.Text);
Label8.Text = totalValue.ToString();
Hi programmers. I can’t figure out why the above line isn’t working. The above line gives me a runtime error that says; Input string was not in a correct format.
as i posted in the other question as well, try to use
int.tryParse()instead, if something goes wrong it just returns 0 instead of that exceptionlike this:
this code will write “0” to the console, because it cant parse “a” to a string
this code will write “25” to the console, because it can parse “5” to an integer number