alex_ea_2a
Member
- Joined
- Mar 2, 2006
- Messages
- 8
- Programming Experience
- Beginner
I need some help with a simple problem. I created a project with a label control "0" and a button control. I Added instructions to a button click handler, so that every time the button is pressed the number in the control increases by 1.
Basicalley what I need is a counter that gives me the number of times that the button is cliked.
Here is the code:
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub btnScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScore.Click
Dim sum As Integer = 0
Dim count As Integer = 1
For count = 1 To 1 Step 1
sum = sum + count
Next
lblScore.Text = Convert.ToString(sum)
Return
End Sub
Basicalley what I need is a counter that gives me the number of times that the button is cliked.
Here is the code:
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub btnScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScore.Click
Dim sum As Integer = 0
Dim count As Integer = 1
For count = 1 To 1 Step 1
sum = sum + count
Next
lblScore.Text = Convert.ToString(sum)
Return
End Sub