Leaving a textbox after deletng content with backspace

Feb 8 2010 3:59 AM

Hi,
I am new to programming and am trying to create an application with Winforms with a SQL database behind to hold the records. I have a problem with a text box that I use to record a product ID. Beside the textbox I have a button which opens a separate form to search the product records by description but it works OK. I want to add functionality that will allow the user to input the ID directly into the box, then check that it is a valid product ID and so far this all works but if I type say the number 3 in the textbox and then delete it, it wil not allow me to leave the textbox without inputting a number, I cannot even clieck the search button. What am I doing wrong? I've tried everything that I can think of. I have a keypress function that only allows numbers and backspace (to allow to clear) and the check on an inputted number is based on the leave event. Any help would be gratefuly accepted.

Answers (1)