|
|
 |
'Timers are the backbone in any good application,
'you will be able to decide when things will happen in millisecounds
'by using timers and counters you gain control
'declare counter as integer
Dim counter As Integer
Private Sub Form_Load()
Timer1.Enabled = False 'disable timer at startup
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True 'starts the timer by enabling it
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False 'stops the timer by disabling it
End Sub
Private Sub Command3_Click()
counter = 0 'reset the counter
End Sub
'The timer procedure
'the timer procedure will loop in the intervall of the timer
'I have set the timer interval in the "properties" menu to 1000 ms (1 sec)
Private Sub Timer1_Timer()
counter = counter + 1 'we set the counter to count here
Text1.Text = counter 'write the counter value out as text
End Sub
|
 |
Option Explicit
Public myName As String
Public myYear As Integer
Public myNumber As Double
'When you declare your variables and definitions
'in a module, they become public for the entire project..
'You may also write your public prosedures or functions in a module.
'Modules are useful for larger projects when you
'want some of your variables or definitions to be globally accessed.
'The Option Explicit call is used for variable name debugginng
|
 |
Visual Basic Source Code |
I hope you found this Visual Basic tutorial useful!
Don't forget to mention Apron Tutorials in your References!
Best Regards
Ronny André Reierstad
|
|
|