View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Grouping radio buttons?

I can't answer your particular VSTO / RadioButton question, however from a
quick look here the control does not appear to have the equivalent of
"Group" property
http://msdn.microsoft.com/en-us/libr...es(VS.80).aspx

Maybe it's up to the programmer to turn all other RadioButtons off when one
is turned on (probably some other way though).

Perhaps you could use Excel's built in ActiveX OptionButton for your needs
(can add manually or programmatically). These have a GroupName property,
which by default is the sheet name at the time the control was added. Your
ComAddin should be able to trap all the control's events in the same way it
might trap any other Excel events.

Regards,
Peter T


"Fabz" wrote in message
...
I am writing a ComAddIn using VSTO (Excel 2007, Visual Studio/VSTO 2008).
Now I want to add some radio buttons
(Microsoft.Office.Tools.Excel.Controls.RadioButto n) on my sheet. However, I
just don't get the idea and it's hard to find any useful information. For
any reason the radio buttons don't seem to be connected, this means when
selecting one of them, the others will not be unselected.

1. Why is this so? And thus, how do I group the radio buttons? Do I
explicitly have to use GroupBox or Panel or something alike? Or is there
some kind of GroupName-Property I can use (I cannot find one)? I also
tried using Controls.AddRadioButton(myRange, myRadioButtonName)
dynamically, but this lead to the same problem.

2. Assuming I indeed have to use some kind of GroupBox, the radio buttons
seem to be positioned according to the GroupBox itself. But I do not want
GroupBox to define their position but the cells into which I originally
positioned the radio buttons. Is there a way to do this?

Thanks for your help.