hi how can i change the backcolor of my label

the SA is the name of the label heres my code

Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 97
SA_Click (0)
Case 115
SA_Click (1)
Case 100
SA_Click (2)
Case 102
SA_Click (3)
Case 103
SA_Click (4)
Case 104
SA_Click (5)
Case 106
SA_Click (6)
Case 107
SA_Click (7)
Case 97
SA_Click (8)
Case 119
SA_Click (9)
Case 101
SA_Click (10)
Case 114
SA_Click (11)
Case 116
SA_Click (12)
Case 121
SA_Click (13)
Case 117
SA_Click (14)
Case 105
SA_Click (15)
Case 111
SA_Click (16)
End Select
End Sub

everytime i click they keyascii letter a the sa_click(0) should change the backcolor and then back to normal how can i do that?

9 Years
Discussion Span
Last Post by ryan311

i have no error sir all i want is this

if i click keyascii 97 = a the SA_CLICK should click and the color of that label should change and then back to normal how can i do that?


You'll want to put the code to change the label (labelname.backcolor = vbred) color in mousedown or keydown, and then change it back to whatever it was previously on mouseup or keyup. You may need to use a variable of some kind (public to the form) to hold the default (or last used) color of the label (before you changed it on keydown)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.