Without seeing your code and you telling us where the exception is being thrown, we can only guess.
Right now, I'm guessing that you are using the textbox the wrong way and watching every keypress and then using Convert.Int32
on the current contents of the textbox.
That is the absolutely wrong thing to do.
The correct thing to do is way for the user to click on a button on the form thta contains your textbox and then try to process the text that was entered. Next, only amateurs or people trying to show demonstration code use Convert
. Production code uses TryParse()
so that an exception is not thrown, but they are notified that there was a parsing error when trying to convert the text into a value. Pros don't use try-catch
for flow control, or for non-exceptional conditions.