RadioButton Control in VB.NET

Submitted by: 
Visitors have accessed this post 3277 times.

The RadioButton component lets you force a user to make a single selection from a set of choices. This component must be used in a group of at least two RadioButton instances. Only one member of the group can be selected at any given time. Now, we will create a RadioButtons that when chose it will change the background color of the Form.

So, now let's start this tutorial!

1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.

2. Next, add three RadioButton named RadioButton1 labeled "Yellow", RadioButton2 labeled "Blue", and RadioButton3 labeled "Red". Then add a Button named Button1. You must design your layout like this:


3. Now, put this code in Button1_Click. This will display the result of changing the color of our form when choosing the preferred color in Radio Buttons.

  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. If RadioButton1.Checked = True Then
  3. Me.BackColor = Color.Yellow
  4. Exit Sub
  5. ElseIf RadioButton2.Checked = True Then
  6. Me.BackColor = Color.Blue
  7. Exit Sub
  8. Else
  9. Me.BackColor = Color.Red
  10. End If
  11. End Sub


We use the code statement of If-else Decision statement to choose from the three different choices. RadioButton1 labeled "Yellow", RadioButton2 labeled "Blue", and RadioButton3 labeled "Red". The checked = True here is our event for our RadioButton as it toggles on and off. When we check RadioButton1, it will have a background color of Yellow ( Me.BackColor = Color.Yellow. The "Me" here indicates that we are referring to Form1. Next, When we check RadioButton2, it will have a background color of Blue ( Me.BackColor = Color.Blue. Otherwise, it will have a background color of Red.


output yellowoutput blueoutput red

Download the source code below and try it! :)

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.

Best Regards,

Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09488225971
E-mail:[email protected]

Follow and add me in my Facebook Account:

Visit and like my page on Facebook at:

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.