help with Time span

wicked14

Member
Joined
Feb 13, 2012
Messages
9
Programming Experience
Beginner
trying to capture the 3 seconds interval of a timespan to prompt a msgbox
for example my timespan value is 00:03 it will display my msgbox, and on 00:06 it wil also display msgbox
 
A TimeSpan is just a static object that contains a value. It doesn't change unless you change it. If you had an Integer variable that contained the value 3, would you expect it to magically change to 6? Of course not, and neither will a TimeSpan.

It sounds like what you want is a Timer. You can add one to your form in the designer. If you set its Interval property to 3000 then it will raise its Tick event every 3000 milliseconds, i.e. every 3 seconds. You call its Start method or set its Enabled property to True to start it raising events. You can then handle its Tick event and do whatever in the event handler, e.g. call MessageBox.Show.
 
Back
Top