|
-
Apr 27th, 2013, 08:06 AM
#3
Re: group box and radio buttons
Hi,
What can I do so that only the change for the newly selected button is recognised? I don't care about the CheckedChanged state for the currently selected button.
In each of your events, you would test for the state of the Checked property to see whether you need to display your message or not. i.e:-
Code:
Private Sub rdoYearly_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rdoYearly.CheckedChanged
If rdoYearly.Checked Then
MsgBox("Yearly")
End If
End Sub
Besides being a visual container for the radio buttons, does the group box server any other purpose, and should code for the group box be included in my code?
The purpose of the GroupBox is to contain items that are related to each other, so in the case of Radio buttons, only one button can be checked at any one time. The best way to demonstrate what the GroupBox is doing is to add another GroupBox to your form, with addition radio buttons, and you will see that only one Radio button can be checked in each GroupBox and the two groups of Radio Buttons are independent of each other.
In addition to this the GroupBox, as with all controls in VB, gives you events that can be coded but in your example you do not need to worry about any events being raised by the GroupBox.
Hope that helps.
Cheers,
Ian
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|