Radio Button and Checkbox

Submitted by: 

Radio button or option button, is a circular control that comes in a group with other controls of the same type. Usually a radio button like an empty circle or a donut. If it is clicked, it will be filled with a big dot. And in every group of radio button only one can be selected by the user. Example in a membership form, there is always a radio button for Gender for Male and Female.


Visual Basic Code:

  1. 'check if the selected radiobutton is male
  2. If RadioButton1.Checked = True Then
  3. 'display that the selected radio button is Male
  4. MsgBox("Your Gender is Male")
  5. 'check if the selected radiobutton is Female
  6. ElseIf RadioButton2.Checked = True Then
  7. 'display that the selected radio button is Female
  8. MsgBox("Your Gender is Female")
  9. End If

CheckBox is quite opposite and similar to Radio Button, because using CheckBox you can do a multiple selection, and unlike the Radio button you can only select one, and it is similar in some way. Example their properties, they have the same Checked property that when selected, will toggle the true or false value.


Visual Basic Code:

  1. 'check if cappucino is selected
  2. If CheckBox1.Checked = True Then
  3. MsgBox("You selected Cappucino")
  4. End If
  5. 'check if Latte is selected
  6. If CheckBox2.Checked = True Then
  7. MsgBox("You selected Latte")
  8. End If
  9. 'check if Hot Coffee is selected
  10. If CheckBox3.Checked = True Then
  11. MsgBox("You selected Hot Coffee")
  12. End If
  13. 'check if Ice Cold Coffee is selected
  14. If CheckBox4.Checked = True Then
  15. MsgBox("You selected Ice Cold Coffee")
  16. End If


good job sir

i like it

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.