It seemed solved but it still has problem.
Although I moved my checking from Leave event to Validating event of a textbox, it still go and check when I click Button.
I set my button's Cause Validating to False.
I do the checking in TextBox Validating event.
If I keyin some data in textBox and didn't go anywhere just directly click on Close button, it still go to Validating event which cause the message box to pop up if same ID is found in Database. And click event is not working too.
Any way to prevent this happen????
Thanks.
You must be doing something wrong but it's not possible to say what from your description. I assure you, if your Button's CausesValidation property is set to False then clicking it will not raise a Validating event on the TextBox. I've attached a project that demonstrates. Try playing with it. The TextBox validates for a numeric value. Try entering different values and then leaving the TextBox in different ways to see the behaviour.