



Basics
Data Types Windows Forms Buttons Check Box Text Box Combo Box Radio Buttons Progress Bar Color & Font Dialogs Open & Save Dialogs Process Control
More Complex Examples
Audio Player Rotating Rectangle
|
Basic Controls with
Visual Basic 2008
Radio Buttons
The primary use of RadioButtons is to give users certain choice
options. Different from checkboxes the user can not select more than one
option at a time. In other words it is basically a choice of this or
that. However RadioButtons can also be embedded in GroupBoxes to allow
for more than one choice option in one Windows form. I will use the
following example to demonstrate.
Create a new project.
From the Toolbox menu create three RadioButtons on the form. Select the
GroupBox icon and draw a GroupBox on the form. Now inside the GroupBox
draw three more RadioButtons. Change the text attribute of RadioButton1
to "Form-A", Radiobutton2 to "Form-B" and RadioButton3 to "Form-C".
Change the text attribute of RadioButton4 to "Blue", RadioButton5 to
"Green" and RadioButton6 to "White". Your form should look something
like this.

Figure 7: RadioButton
Now double click on each RadioButton and
change its event handling code to the following:
Public Class Form1
Private Sub RadioButton1_CheckedChanged(ByVal
sender As System.Object,
ByVal ...
Me.Text = "Form-A"
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal
sender As System.Object,
ByVal...
Me.Text = "Form-B"
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal
sender As System.Object,
ByVal ...
Me.Text = "Form-C"
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal
sender As System.Object,
ByVal ...
Me.BackColor = Color.Blue
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal
sender As System.Object,
ByVal ...
Me.BackColor = Color.Green
End Sub
Private Sub RadioButton6_CheckedChanged(ByVal
sender As System.Object,
ByVal ...
Me.BackColor = Color.White
End Sub
End Class
When you run the application you will see that when you select one of
the top three Radiobuttons
Continue to the next page.
If you liked this article then Please
Thumb This Up with a short review -

Email us at: info@pro2visual.com
|
Popular Articles
Moving a borderless form in vb.net
ComboBox1.Items.Add
Link Progress Bar with
Timer in vb.net
How to
open a folder using the process control
Start Vb.net programming. No get
rich quick scam
How to Convert the Date
Format |