Introduction: The checkbox control is used, when we have need to select more then one options from list.

For example- We take four CheckBox, one Button and two TextBlock in silverlight application. Then we change content of CheckBox as Cricket,Hockey,Football,Tennis and text of TextBlock1 as Selected Game and content of Button as Ok. It will look like below figure

Figure-11.gif

Figure-1

On Button Click event, we write following code.

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
TextBlock2.Text = ""
If CheckBox1.IsChecked = True Then
TextBlock2.Text += " Cricket"
End If
If CheckBox2.IsChecked = True Then
textBlock2.Text += " Hockey"
End If
If CheckBox3.IsChecked = True Then
textBlock2.Text += " Football"
End If
If CheckBox4.IsChecked = True Then
textBlock2.Text += " Tennis"
End If
End
Sub

Now, We run our application and check on any CheckBox. as figure 2

Figure-14.gif

Figure-2

Then we Click on Ok Button. Then output will show as below figure.

Figure-13.gif

Figure-3