I’m looking for an code example/algorithm to do an action if the user has not entered anything in textbox for a period of 3 seconds.
My scenery: I have a textbox that I want submit if the textbox has focus, but the user has not written anything for 3 seconds. is this possible?
You need to setup a
System.Windows.Forms.Timertimer. Whenever the text in the textbox changes, (TextChangedevent) you need to restart the timer to fire in 3 seconds. If the timer ever fires, this means that 3 seconds have elapsed while the user has not typed anything.However, be advised that this is very bizarre behavior on behalf of your application, and it is highly unlikely that it will be appreciated by any user out there.