Reputation: 31
I am trying to change the BackColor of my listbox to white. I have succeeded in changing it to red(to show a missing input) but I want it to change back to white when clicked. My code is:
Private Sub lstEqualToOrAround_Click()
lstEqualToOrAround.BackColor = &H8000000F
End Sub
By using watch, I can see that the event is triggered and runs the code but it does not change the color. I don't know why.
I have tried making it call another Sub and changing the color from there but I did not work for this case. However, I can do other things within the New Sub or 'Click' event but I cannot change the BackColor
Edit: I have gotten it working using the 'DblClick' event but that is not what I want for the user.(I have to use vba because we have no access to anything else)
Upvotes: 3
Views: 1123
Reputation: 3746
Because function have not parameter from Screen will cant refesh to screen.
You can use MouseDown
event instead of Click
event
Private Sub lstEqualToOrAround_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
lstEqualToOrAround.backColor = &H8000000F
End Sub
Upvotes: 2