Wait while the button was not pressed...

sitajony

Active Member
Licensed User
Wait while the button is not pressed...

Hi, I would know if it's possible to wait that a button is pressed before continue the code...
Example:
do until champ.Text="ok"
formwithchamp.show 'This form have the "champ" (textbox) control with a button for validate and continue...
loop

Thanks for your answers!
 
Last edited:

mjcoon

Well-Known Member
Licensed User
Hi, I would know if it's possible to wait that a button is pressed before continue the code...
Example:
do until champ.Text="ok"
formwithchamp.show 'This form have the "champ" (textbox) control with a button for validate and continue...
loop

If you read the first few pages of how to write a starter program in the new tutorial book, you'll see that waiting until something happens is very easy! It is implied just by showing a form.

What may be more of a problem is that there is no concept of "continue" in Sub App_Start because activity shifts to the Sub that processes the click on the button. When that Sub ends the waiting commences again until the user does something else that is allowed for in the program.

Your example loop does not do anything very interesting. But if, in another example, you might want to be doing a For ... Step loop with a count going up each time a button is pressed, you cannot write it that way (except by using a MsgBox() call). But you can get the same effect by making the counting variable a global one, and incrementing it in the button-press Sub.

HTH, Mike.
 
Top