|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
determine which radiobutton in a groupbox is checked?Hello,
I have a groupbox that contains 3 radiobuttons. Is there a groupbox property or some syntax that identifies which radiobutton is checked? Or do I have to loop? For Each rad As RadioButton In grpBox1.Controls If rad.Checked.Equals(True) Then Console.WriteLine(rad.Name) Next vs (pseudo code) Console.WriteLine(grpBox1.Controls.Checked.Name) Thanks, Rich You can use
Select Case True Case rad1.checked ... do something Case rad2.checked ... do something End Select Matt Show quoteHide quote "Rich" <R***@discussions.microsoft.com> wrote in message news:3B0241B6-3657-497A-8C25-93A7CA34830A@microsoft.com... > Hello, > > I have a groupbox that contains 3 radiobuttons. Is there a groupbox > property or some syntax that identifies which radiobutton is checked? Or > do > I have to loop? > > For Each rad As RadioButton In grpBox1.Controls > If rad.Checked.Equals(True) Then Console.WriteLine(rad.Name) > Next > > vs > > (pseudo code) > Console.WriteLine(grpBox1.Controls.Checked.Name) > > > Thanks, > Rich "Rich" <R***@discussions.microsoft.com> schrieb: Add a common event handler to all the radio buttons which belong to a group:> I have a groupbox that contains 3 radiobuttons. Is there a groupbox > property or some syntax that identifies which radiobutton is checked? Or > do > I have to loop? \\\ Private m_Group1SelectedRadioButton As RadioButton Private Sub RadioButtonGroup1_CheckedChanged( _ ByVal sender As Object, _ ByVal e As EventArgs _ ) Handles _ RadioButton1.CheckedChanged, _ RadioButton2.CheckedChanged, _ RadioButton3.CheckedChanged Dim SourceControl As RadioButton = DirectCast(sender, RadioButton) If SourceControl.Checked Then m_Group1SelectedRadioButton = SourceControl End If End Sub /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
ActiveX.exe and RaiseEvent
need help with a string manipulation. Late Binding Return Value Weirdness Hindi numbers in Graphics class Threads do not Terminate! OpenFileDialog Handle Leak read textbox into array - vb2005 DataGridView Question - VB.NET 2005 REGULAR EXPRESSION extract a word and text around it Browsing Records |
|||||||||||||||||||||||