Multi Function Buttons

How do make a button with the title command8 put the following values into text1.text depending on the number of clicks

number of clicks    values
1                     a
2                     b
3                     c
4                     1
Warsteiner99Asked:
Who is Participating?
 
autConnect With a Mentor Commented:
Here's the code you need:

Private Sub Command8_Click()
    Static ClickCount As Long
   
    ClickCount = ClickCount + 1
   
    Select Case ClickCount
        Case 1
            Text1.Text = "a"
        Case 2
            Text1.Text = "b"
        Case 3
            Text1.Text = "c"
        Case 4
            Text1.Text = "1"
    End Select
End Sub
0
 
VbmasterCommented:
You mean something like this?

Sub Command8_Click()

  Static Counter As Integer
  Counter = Count + 1

  Text1.Text = Choose(Counter, "a", "b", "c", 1)

End Sub
0
 
VbmasterCommented:
Oops, the third line should be

  Counter = Counter + 1
0
All Courses

From novice to tech pro — start learning today.