Can you mark a command box as already selected?

J

jhucks8

I was wondering if there was anyway to mark a command box as being selected
once it is clicked. I'm trying to create a training game and I don't want
trainees to select the same category twice.
 
D

Douglas J Steele

Try using a Toggle Button, rather than a Command Button. Clicking on a
Toggle Button depresses it, so that you can tell it's already been clicked.

You can also put a Static variable in the Click event of the Command Button
to keep track of whether it's already been clicked:

Private Sub Command0_Click()
Static booClicked As Boolean

If booClicked = False Then
' put your code that's supposed to happen when you click here

booClicked = True
Else
MsgBox "You've already clicked on the button"
End If

End Sub
 
J

jhucks8

Thanks Douglas! That really helps!

Douglas J Steele said:
Try using a Toggle Button, rather than a Command Button. Clicking on a
Toggle Button depresses it, so that you can tell it's already been clicked.

You can also put a Static variable in the Click event of the Command Button
to keep track of whether it's already been clicked:

Private Sub Command0_Click()
Static booClicked As Boolean

If booClicked = False Then
' put your code that's supposed to happen when you click here

booClicked = True
Else
MsgBox "You've already clicked on the button"
End If

End Sub
 
Top