Forum Discussion

Yassirmosawi's avatar
Yassirmosawi
Copper Contributor
Mar 10, 2021

Grouping buttons

Hi, I have a form containing 25 command buttons divided into 5 groups. I want them to behave like a radio button, that is, when I click a button in group "a" it will be red and all other 4 button of the group remain blue (for example). Till now I used a function to set all buttons first:
Function groupA()
B1.quickstyle=1
B2.quickstyle=1
B3.quickstyle=1
B4.quickstyle=1
B5.quickstyle=1
End function

Then in every button click event I change its color:
Sub B1_click()
groupA
B1.quickstyle=8
End sub

Is there a better way?
    • Yassirmosawi's avatar
      Yassirmosawi
      Copper Contributor
      Thanks, that's what I need. Can I make the quickstyle of the selected button (toggle button) change when it is selected (clicked)?
      • George_Hepworth's avatar
        George_Hepworth
        Silver Contributor
        I'm not sure how much control you have over the appearance of radio buttons. Perhaps try it out and see if the default behavior is sufficient.