Changes

Jump to: navigation, search

Understanding Visual Basic Events

360 bytes added, 18:24, 17 July 2007
Setting Up a Visual Basic Timer Event
[[Image:visual_basic_timer_object.jpg]]
With the ''Timer'' object selected, use the ''Properties'' panel to change the ''Enabled'' property to ''True'' and the ''Interval'' property to ''10000''(which will cause the Timer to trigger a ''Tick'' event every 10 seconds). Next double click on the ''Timer'' object to edit the event procedure. The ''Timer'' object has a single event, the ''Tick'' event, which is triggered each time the timer interval elapses. We are going to write code to set the myLabel control to display ''Your time is up'' when the ''Tick'' event triggers:
<pre>
End Sub
</pre>
 
Build and run the application and notice that after 10 seconds the label text changes to "Your time is up". Enter some text into the TextBox so that the Label text changes again and wait 10 seconds. Once again, the Timer will trigger the ''Tick'' event and the Label text will change.

Navigation menu