9. Radio Button And Check Box

This tutorial will show you how to use the Radio Button and Check Box object in your application. Here we start to integrate parts of the language that we have previously covered and you can see how to use the If Statement in a real situation. The examples shown in this tutorial are for beginners and are meant to try and help you understand how the objects work.


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If RadioButton1.Checked = True Then
            MessageBox.Show("You are under 16!")
        ElseIf RadioButton2.Checked = True Then
            MessageBox.Show("You are over 16!")
        End If

        If CheckBox1.Checked = True Then
            MessageBox.Show("You like Harry Potter, nerd")
        End If

        If CheckBox2.Checked = True Then
            MessageBox.Show("What the hell, 2010 sucked")
        End If

        If CheckBox3.Checked = True Then
            MessageBox.Show("the simpsons movie is a conspiracy dude")
        End If

    End Sub

End Class