looping while mousedown

Hey everybody… I am facing this silly problem… (it should be easy but I don’t know how to do it)…

in a pushbutton, mousedown event I wtore this code… :

Today.Day = Today.day+1
PopulateListBoxA
PopulateListBoxB

That’s it… So, when I click the button, the listboxes update their data, showing the info corresponding to one day later…

I would like this to happen in a loop while the button is pressed. So If the user wants to go 10 days in the future does not need to do 10 clicks, but rather keep the finger down and the app will move days forward.

How can I achieve this ?
thnks in advance
Roman

use a timer
the event of the timer calls the update code you have above

MouseDown activates the timer… so every “x” seconds the listbox updates
MouseUp stops the timer

I was about to suggest a loop that checks System.MouseDown, but Dave’s solution is much better. Like, much, much better.

Remember to return true in MouseDown so MouseUp files eventually. Or you can have the Timer check System.MouseDown and deactivate itself once its false.