I have a list of 20-30 toggle buttons, I need a simple code that once one of the button is clicked the rest of the buttons will change color/caption and if one was
ToggleButton1.Value = True then it will change to ToggleButton1.Value = False (while the clicked one will change to True)
I have the following:
Private Sub ToggleButton1_Click()
If ToggleButton1.Value = True Then
ToggleButton1.Caption = "Dan Active"
ToggleButton1.BackColor = RGB(0, 254, 0)
ToggleButton1.FontSize = 11
ToggleButton1.Font.Bold = True
ToggleButton1.ForeColor = RGB(0, 0, 0)
ToggleButton2.Value = False
ToggleButton2.Caption = "Michael"
ToggleButton2.BackColor = RGB(192, 192, 192)
ToggleButton2.FontSize = 11
ToggleButton2.Font.Bold = False
ToggleButton2.ForeColor = RGB(0, 0, 0)
Else
ToggleButton1.Caption = "Dan"
ToggleButton1.BackColor = RGB(192, 192, 192)
ToggleButton1.FontSize = 11
ToggleButton1.Font.Bold = False
ToggleButton1.ForeColor = RGB(0, 0, 0)
End If
End Sub
I dont want to repeat the BOLD section to all the buttons (each button has a different name) so Im looking for a simple code to do it as I need to repeat it to all the buttons I have.
thanks
ToggleButton1.Value = True then it will change to ToggleButton1.Value = False (while the clicked one will change to True)
I have the following:
Private Sub ToggleButton1_Click()
If ToggleButton1.Value = True Then
ToggleButton1.Caption = "Dan Active"
ToggleButton1.BackColor = RGB(0, 254, 0)
ToggleButton1.FontSize = 11
ToggleButton1.Font.Bold = True
ToggleButton1.ForeColor = RGB(0, 0, 0)
ToggleButton2.Value = False
ToggleButton2.Caption = "Michael"
ToggleButton2.BackColor = RGB(192, 192, 192)
ToggleButton2.FontSize = 11
ToggleButton2.Font.Bold = False
ToggleButton2.ForeColor = RGB(0, 0, 0)
Else
ToggleButton1.Caption = "Dan"
ToggleButton1.BackColor = RGB(192, 192, 192)
ToggleButton1.FontSize = 11
ToggleButton1.Font.Bold = False
ToggleButton1.ForeColor = RGB(0, 0, 0)
End If
End Sub
I dont want to repeat the BOLD section to all the buttons (each button has a different name) so Im looking for a simple code to do it as I need to repeat it to all the buttons I have.
thanks