37 lines
1.9 KiB
Text
37 lines
1.9 KiB
Text
iCount As Integer 'Counter of clicks!
|
|
hLabel As Label 'We need a Label
|
|
|
|
Public Sub Form_Open()
|
|
Dim hButton As Button 'We need a Button
|
|
|
|
With Me 'Set the Form's Properties..
|
|
.height = 75 'Set the Height
|
|
.Width = 300 'Set the Width
|
|
.Arrangement = Arrange.Vertical 'Arrange items vertically
|
|
.Padding = 5 'Border area
|
|
.Title = "Click counter!" 'Title displayed on the Form
|
|
End With
|
|
|
|
hlabel = New Label(Me) 'Add a Label to the form
|
|
|
|
With hlabel 'Set the Label's Properties..
|
|
.expand = True 'Expand the Label to fit the Form
|
|
.Text = "There have been no clicks yet" 'Add Text to the Label
|
|
.Alignment = Align.Center 'Center the Text
|
|
End With
|
|
|
|
hButton = New Button(Me) As "Button1" 'Add a Button to the form as Event "Button1"
|
|
|
|
With hButton 'Set the Button's Properties..
|
|
.Height = 28 'Set the Height
|
|
.Text = "&Click me" 'Add Text (The '&' adds a keyboard shortcut)
|
|
End With
|
|
|
|
End
|
|
|
|
Public Sub Button1_Click() 'When the Button is clicked..
|
|
|
|
Inc iCount 'Increase the value of iCount
|
|
hLabel.text = "The button has been clicked " & iCount & " times" 'Display the amount of clicks"
|
|
|
|
End
|