Thank you for your reply, but that is sort of what I am already doing in my
workaround. Here is what I am currently doing
dim arrRads() as RadioButton = New RadioButton(){rad1, rad2, rad3}
For each rad As RadioButton In arrRads
AddHandler rad.Click, AddressOf CheckChanged
Next
Private Sub CheckChanged(...)
Dim rad As RadioButton = Ctype(Sender, RadioButton)
If rad.Name.Equal("rad1") Then global_Int = 1
....
End Sub
Your method is a little bit better, but I still have to get the index of the
radiobtn. Is there a way I could do your thing to get the index from my
array above?
GetIndext(arrRads(rad)) -- arrRads(rad).IndexOf
With your suggestion I am getting a little bit closer to what I want. I
think the trick will be in the IndexOf property. How to apply it?
"Jeremy Cowles" wrote:
Quote:
On Jan 11, 9:37 am, Rich <R...@discussions.microsoft.comwrote:
Quote:
If you enclose a group of radiobuttons (option buttons in MS Access) in an
option group control (a frame control) in Access -- the frame control will
return the index of the option button that is checked.
In VB.Net if I enclose a group of radiobuttons in a groupbox control - I get
the single checked radiobutton behavior, but the groupbox does not seem to
return the index of the checked radiobutton. Is there a way to get the
groupbox control to return the index of the checked radiobutton? Or is there
some control structure that could do this?
Rich
>
I think the easiest way to replicate indexed controls is to have one
event handler for all controls in the array. For example, if you have
two radio buttons, RadioButton1 and RadioButton2, the following cold
should accomplish what you want:
>
Private CheckedRadio As RadioButton
Private Sub Options_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles RadioButton1.CheckedChanged, _
RadioButton2.CheckedChanged
>
Dim c As RadioButton = CType(sender, RadioButton)
If c.Checked Then
CheckedRadio = c
End If
End Sub
>
Now after a radio button is checked, the variable CheckedRadio will be
a reference to the checked control.
>
Is that what you were trying to do?
>
-
Jeremy
>