471,093 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,093 software developers and data experts.

Assign a value to groupbox from a radiobutton contained in groupbo

Hello,

Is it possible to assign a value to a groupbox by selecting a radiobutton
contained in the groupbox?

Say you assign a value of 1 to radbtn1, 2 for radbtn2, 3 for radbtn3 all
contained in grpBox. You click radbtn1.

Console.writeline(grpBox.Value.ToString)

Is there a way to do something like this? (VB2005)

Thanks,
Rich
Aug 4 '06 #1
2 6436
"Rich" <Ri**@discussions.microsoft.comschrieb:
Is it possible to assign a value to a groupbox by selecting a radiobutton
contained in the groupbox?

Say you assign a value of 1 to radbtn1, 2 for radbtn2, 3 for radbtn3 all
contained in grpBox. You click radbtn1.

Console.writeline(grpBox.Value.ToString)

Is there a way to do something like this? (VB2005)
Add a common event handler to all the radio buttons which belong to a group:

\\\
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/>

Aug 4 '06 #2
Thank you very much. That was just what I was looking for.

Rich

"Herfried K. Wagner [MVP]" wrote:
"Rich" <Ri**@discussions.microsoft.comschrieb:
Is it possible to assign a value to a groupbox by selecting a radiobutton
contained in the groupbox?

Say you assign a value of 1 to radbtn1, 2 for radbtn2, 3 for radbtn3 all
contained in grpBox. You click radbtn1.

Console.writeline(grpBox.Value.ToString)

Is there a way to do something like this? (VB2005)

Add a common event handler to all the radio buttons which belong to a group:

\\\
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/>

Aug 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Sergei | last post: by
1 post views Thread by harpreet1433 | last post: by
1 post views Thread by No_Spam | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.