Vb.net Database Authentication?

one of the fields on my form is a textbox where the user enters an id. this is a foreign key to another table, so I need to bounce data from that table before posting it. I would prefer not to use textchanged as every email they type may trigger a different request, losing focus will only show an error or check when they are already in a different field (not sure if it fires if they just clicked submit button).

I would rather not force someone to focus on staying in this area, but perhaps this is the best way?

Is there a way to sleep and wait to see if there is another key event within X seconds? if so, can I peek to see if it is a letter or number or tab or go back?

Is there another event I have to connect to this user?

Should I pull a copy of this table column and compare in real time? (I could add a refresh button to pull the new cache)

+1


a source to share


1 answer


You might want to use a timer for this.

Disable and enable the control every time a key is pressed, before resetting the timeout.



Then, when the timer event occurs, turn off control and query the database.

EDIT: I still think your best bet is probably at the Lost Focus event.

+1


a source







All Articles