I think I tracked down a problem in my Web app, and think that it arises when code in a PushButton's Action event executes too soon. I need it to execute after the LostFocus event of a field executes completely. The PushButton seems to work if the user clicks out of the field in question and then clicks the PushButton. The problem seems to occasionally arise if they click the PushButton immediately after changing data in the field in question.
In this forum I have found this, but with a warning that it's not good to use in modern day UI code:
// do nothing for 1/4 second or so Dim waitUntil As Integer = Ticks + 15 While ticks < waitUntil Wend
I also see use of
to accomplish something similar. But won't the SleepCurrentThread code interfere with the LostFocus event I'm talking about? That is, wouldn't it halt all code execution in that thread, thusly working against what I'm trying to do?
Would a WebTimer with a Period of 250 (placed at the beginning of the PushButton Action event) accomplish what I'm trying to do and be more fitting with modern UI programming?