hi I have a winform which has several controls like datagridviewes, textboxes, listboxes and so on. The senario is that when a user enters a code in textbox1, system checkes for its validation and then automatically retrieves its related data from database and finally the user can save all the data into database.
But if the data user has entered is not valid, I think it's better to display a message to user and prevent him from continuing to enter other data.
Is this possible by using events? Or you suggest a better solution? Actually is there any best practice for such these senarios?
Thanks in advance
I hope I understood your problem correctly.
You have several controls in the form and you are entering a particular code in the textbox and if that code is correct it will fetch some data from database and if that code is incorrect warn the user for invalid code and set the focus back to the textbox.
You can do the following for the same.