So I am making very simple app and I have a text box where the user enters a number, I convert the string in the text box to a number by doing the following:
Then I have an if statement and that works, but but when I go to enter a new number in the text box it already has a zero and if I delete it breaks application, and if I use Clear(), it breaks at that point as well, see below:
Please use code tags when providing code, it helps tremendously while reading the code. To format you post with code tags click the <> icon just under the word "Format:" on the side of the edit box.
As for the problem, you are converting the value to an int every time the text is changed; therefore, you delete the '0' is changing the text and invoking a call to
textBox1_TextChanged
The computer can not convert a blank character into an integer.