fantasma62 Posted November 24, 2002 Posted November 24, 2002 I have to labels and two buttons. What code can I use if I want a label to show a number and increase it in increments of one when I press a button? What code can I use to do the same with the other button so that in its corresponding label shows a number and increments it by one once you press the button? Also, as you increase the numbers in one, how can i decrease it on the other? Thanks Quote
*Gurus* Derek Stone Posted November 24, 2002 *Gurus* Posted November 24, 2002 Class yourClass Private iNumber1 As Integer = 10 Private iNumber2 As Integer = 10 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click iNumber1 += 1 iNumber2 -= 1 Label1.Text = iNumber1.ToString() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click iNumber2 += 1 iNumber1 -= 1 Label2.Text = iNumber2.ToString() End Sub End Class 'yourClass Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.