Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

option button colour change

Status
Not open for further replies.

johnnyv

Programmer
Jul 13, 2001
216
CA
Hello all
A simple problem I think.

I have a series of option buttons that by default are grey in colour. When the user selects one of these buttons I would like it to change to a different colour. If the user changes their mind and selects a different button I would like the first button selected to change it colour back to grey.

What is the easiest way to make this happen?
Are there setting in the properties window for each of the buttons I can set.

Thanks in advance for any responses
 
Just set (and reset) the OptionButton Backcolor property in it's click event. For 2 Options:

Private Sub Option1_Click()
Option1.BackColor = vbGreen
Option2.BackColor = &H8000000F
End Sub

Private Sub Option2_Click()
Option2.BackColor = vbGreen
Option1.BackColor = &H8000000F
End Sub


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
I would Index the option buttons... Name them opt(0 through X)

Then...

Private Sub opt_Click(Index as Integer)

For i = 0 to opt.Count - 1
opt(i).BackColor = &H8000000F
Next i
opt(Index).BackColor = vbRed

End Sub

Casper

There is room for all of gods creatures, "Right Beside the Mashed Potatoes".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top