|
To support check boxes, the .NET Framework provides
the
CheckBox class. To add a check box to your application at design time,
from the Common Controls section of the Toolbox, yon can click the CheckBox control
and click the form or a container on the form. Unlike the radio button but
like the regular command button, a check box can safely be positioned
directly on a form.
To programmatically create a check box, declare a
variable of type CheckBox, use the new operator to allocate memory
for it, and add it to the Controls collection of its holder. Here
is an example:
Imports System.Drawing
Imports System.Windows.Forms
Module Exercise
Public Class Starter
Inherits Form
Private chkValidate As CheckBox
Dim components As System.ComponentModel.Container
Public Sub New()
InitializeComponent()
End Sub
Public Sub InitializeComponent()
chkValidate = New CheckBox()
Controls.Add(chkValidate)
End Sub
End Class
Function Main() As Integer
Dim frmStart As Starter = New Starter
Application.Run(frmStart)
Return 0
End Function
End Module
Unlike the radio button that usually comes along with
other radio buttons, a check box can appear by itself. Even when it comes
in a group with others, the behavior of one check box is independent of
the other check boxes, even if they belong to the same group.
|
Practical Learning: Introducing Check Boxes
|
|
- Start a new Windows Application named DaniloPizza1
- In the Solution Explorer, right-click Form1.vb and click Rename
- Type Exercise.vb and press Enter
- On the main menu, click Project -> Add New Item...
- In the Templates list, click Icon File
- Set the Name to pizza and click Add
- Using the Erase tool
,
wipe its interior to erase its content
- Use the Ellipse tool
and the black color to draw an oval shape
- Fill
it up with a brown color (the color on the right side of the black)
- Click the red color
- Click the Airbrush tool
- Click the option button and select the Medium brush
- Randomly click different parts of the shape
- To give the appearance of a crust, use the Pencil tool
,
click the black color, right-click the brown color, and draw a dark
border around the shape
- With still the black and the brown colors, randomly click and
right-click different points in the shape:
- Click the white color. Right-click the yellow color. Randomly click
and right-click a few times in the shape
- Click the brown color again and click the Line tool
- Randomly draw horizontal, vertical, and dialog lines in the shape
- Right-click a white section in the drawing area, position the mouse
on Current Icon Image Types, and click 16x16, 16 Colors
- Design it as follows:
- Save the icon and close it
- Use the Icon field of the form in the Properties window to assign
the pizza.ico icon to the form
- Design the form as follows:
 |
| Control |
Text |
Name |
Additional Properties |
| GroupBox |
 |
Pizza Size |
|
|
| RadioButton |
 |
Small |
rdoSmall |
|
| TextBox |
 |
8.95 |
txtSmall |
AlignText: Right |
| RadioButton |
 |
Medium |
rdoMedium |
Checked: True |
| TextBox |
 |
10.75 |
txtMedium |
AlignText: Right |
| RadioButton |
 |
Large |
rdoLarge |
|
| TextBox |
 |
12.95 |
txtLarge |
AlignText: Right |
| GroupBox |
 |
Side Orders |
|
|
| Label |
 |
Qty |
|
|
| Label |
 |
Unit Price |
|
|
| Label |
 |
Sub Total |
|
|
| Label |
 |
Bread Sticks |
|
|
| TextBox |
 |
0 |
txtQtyBread |
AlignText: Right |
| TextBox |
 |
3.25 |
txtPriceBread |
AlignText: Right |
| TextBox |
 |
0.00 |
txtTotalBread |
AlignText: Right
ReadOnly: True |
| Label |
 |
Buffalo Wings |
|
|
| TextBox |
 |
0 |
txtQtyWings |
AlignText: Right |
| TextBox |
 |
2.15 |
txtPriceWings |
AlignText: Right |
| TextBox |
 |
0.00 |
txtTotalWings |
AlignText: Right
ReadOnly: True |
| GroupBox |
 |
Toppings |
|
|
| CheckBox |
 |
Pepperoni |
chkPepperoni |
|
| CheckBox |
 |
Sausage |
chkSausage |
|
| CheckBox |
 |
Extra Cheese |
chkExtraCheese |
|
| CheckBox |
 |
Olives |
chkOlives |
|
| CheckBox |
 |
Onions |
chkOnions |
|
| Label |
 |
Each Topping |
|
|
| TextBox |
 |
0.45 |
txtEachTopping |
AlignText: Right |
| GroupBox |
 |
Drinks |
|
|
| Label |
 |
Qty |
|
|
| Label |
 |
Unit Price |
|
|
| Label |
 |
Sub Total |
|
|
| Label |
 |
Soda Can |
|
|
| TextBox |
 |
0 |
txtQtyCan |
AlignText: Right |
| TextBox |
 |
1.45 |
txtPriceCan |
AlignText: Right |
| TextBox |
 |
0.00 |
txtTotalCan |
AlignText: Right
ReadOnly: True |
| Label |
 |
Soda 20 Oz. |
|
|
| TextBox |
 |
0 |
txtQtySoda20 |
AlignText: Right |
| TextBox |
 |
1.45 |
txtPriceSoda20 |
AlignText: Right |
| TextBox |
 |
0.00 |
txtTotalSoda20 |
AlignText: Right
ReadOnly: True |
| Label |
 |
Soda 2L Bottle |
|
|
| TextBox |
 |
0 |
txtQtySoda2L |
AlignText: Right |
| TextBox |
 |
1.45 |
txtPriceSoda2L |
AlignText: Right |
| TextBox |
 |
0.00 |
txtTotalSoda2L |
AlignText: Right
ReadOnly: True |
| Label |
 |
Orange Juice |
|
|
| TextBox |
 |
0 |
txtQtyOJ |
AlignText: Right |
| TextBox |
 |
2.25 |
txtPriceOJ |
AlignText: Right |
| TextBox |
 |
0.00 |
txtTotalOJ |
AlignText: Right
ReadOnly: True |
| Label |
 |
Water |
|
|
| TextBox |
 |
0 |
txtQtyWater |
AlignText: Right |
| TextBox |
 |
1.25 |
txtPriceWater |
AlignText: Right |
| TextBox |
 |
0.00 |
txtTotalWater |
AlignText: Right
ReadOnly: True |
| Button |
 |
Close |
btnClose |
|
| Label |
 |
Total Price |
|
|
| TextBox |
 |
0.00 |
txtTotalPrice |
AlignRight: Right
ReadOnly: True |
|
- Save everything
|
Check Box Characteristics |
|
By default, a check box appears empty, which makes its statement false. To make the statement
true, the user can click it. There are three main ways you can use this
property of a check box. To select a check box, you can set its Checked
property to True. You can also do it programmatically as follows: Public Sub InitializeComponent()
chkValidate = New CheckBox()
Controls.Add(chkValidate)
chkValidate.Checked = True
End Sub
To find out if an item is selected, get the value
of its Checked property. Another possibility consists of toggling
the state of the check mark. For example,
you can check or uncheck the check mark when the user clicks another
button. To do this, you can simply negate the truthfulness of the control
as follows.
Like the radio button, when a check box is clicked, the control fires a CheckedChanged
event to let you know that it has been checked. This event is of
type EventArgs. If the check box can display only two states, checked
or unchecked, this event is enough.
|
Practical Learning: Configuring Check Boxes
|
|
- Right-click the form and click View Code
- Inside the class, create the following procedure:
Public Class Exercise
Private Sub CalculatePrice()
Dim PriceSize As Double
Dim PriceEachTopping As Double
Dim BWings As Double
Dim Bread As Double
Dim SodaCan As Double
Dim Soda20 As Double
Dim Soda2L, OJ As Double
Dim Water As Double
Dim PriceToppings As Double
Dim TotalOrder As Double
Dim Pepperoni As Integer
Dim Sausage As Integer
Dim ExtraCheese As Integer
Dim Onions As Integer
Dim Olives As Integer
Try
' Get the price of pizza depending on the selected size
If rdoSmall.Checked = True Then
PriceSize = CDbl(txtSmall.Text)
End If
If rdoMedium.Checked = True Then
PriceSize = CDbl(txtMedium.Text)
End If
If rdoLarge.Checked = True Then
PriceSize = CDbl(txtLarge.Text)
End If
Catch ex As Exception
MsgBox("The value you typed for the price of a pizza is invalid" & _
vbCrLf & "Please try again")
End Try
' Get the price of a topping if it was selected
If chkPepperoni.Checked = True Then
Pepperoni = 1
Else
Pepperoni = 0
End If
If chkSausage.Checked = True Then
Sausage = 1
Else
Sausage = 0
End If
If chkExtraCheese.Checked = True Then
ExtraCheese = 1
Else
ExtraCheese = 0
End If
If chkOnions.Checked = True Then
Onions = 1
Else
Onions = 0
End If
If chkOlives.Checked = True Then
Olives = 1
Else
Olives = 0
End If
' Get the price of each topping
Try
PriceEachTopping = CDbl(txtEachTopping.Text)
Catch
MsgBox("The value you typed for the price of a each topping is invalid" & _
vbCrLf & "Please try again")
End Try
PriceToppings = (Pepperoni + Sausage + ExtraCheese + _
Onions + Olives) * PriceEachTopping
' Calculate the price of the side dishes
' depending on the quantity entered
BWings = CDbl(txtTotalWings.Text)
Bread = CDbl(txtTotalBread.Text)
' Calculate the price of the drink(s)
SodaCan = CDbl(txtTotalCan.Text)
Soda20 = CDbl(txtTotalSoda20.Text)
Soda2L = CDbl(txtTotalSoda2L.Text)
OJ = CDbl(txtTotalOJ.Text)
Water = CDbl(txtTotalWater.Text)
TotalOrder = PriceSize + PriceToppings + BWings + Bread + _
SodaCan + Soda20 + Soda2L + OJ + Water
txtTotalOrder.Text = FormatNumber(TotalOrder)
End Sub
End Class
|
- Under the above procedure, create the following procedure:
Private Sub rdoSmall_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles rdoSmall.Click, _
rdoMedium.Click, _
rdoMedium.Click, _
chkExtraCheese.Click, _
chkOlives.Click, _
chkOnions.Click, _
chkPepperoni.Click, _
chkSausage.Click
CalculatePrice()
End Sub
|
- Under the above procedure, create the following procedure:
Private Sub ItemPriceLeave(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles txtSmall.Leave, _
txtMedium.Leave, _
txtLarge.Leave, _
txtMedium.Leave, _
txtLarge.Leave, _
txtEachTopping.Leave, _
txtQtyBread.Leave, _
txtPriceBread.Leave, _
txtQtyWings.Leave, _
txtPriceWings.Leave, _
txtQtyCan.Leave, _
txtPriceCan.Leave, _
txtQtySoda20.Leave, _
txtPriceSoda20.Leave, _
txtQtySoda2L.Leave, _
txtPriceSoda2L.Leave, _
txtQtyOJ.Leave, _
txtPriceOJ.Leave, _
txtQtyWater.Leave, _
txtPriceWater.Leave
Dim QtyBread As Integer
Dim QtyWings As Integer
Dim QtyCan As Integer
Dim QtySoda20 As Integer
Dim QtySoda2L As Integer
Dim QtyOJ As Integer
Dim QtyWater As Integer
Dim PriceBread As Double
Dim TotalBread As Double
Dim PriceWings As Double
Dim TotalWings As Double
Dim PriceCan As Double
Dim TotalCan As Double
Dim PriceSoda20 As Double
Dim TotalSoda20 As Double
Dim PriceSoda2L As Double
Dim TotalSoda2L As Double
Dim PriceOJ As Double
Dim TotalOJ As Double
Dim PriceWater As Double
Dim TotalWater As Double
' Retrieve the quantity set in the text box
Try
QtyBread = CInt(txtQtyBread.Text)
Catch ex As Exception
MsgBox("The value you entered for the quantify " & _
"of bread sticks is not valid" & _
vbCrLf & "Please try again!")
End Try
' Get the unit price of the item
Try
PriceBread = CDbl(txtPriceBread.Text)
Catch ex As Exception
MsgBox("The value you entered for the price " & _
"of bread sticks is not valid" & _
vbCrLf & "Please try again!")
End Try
' Calculate the sub-total of this item
TotalBread = QtyBread * PriceBread
' Display the sub-total in the corresponding text box
txtTotalBread.Text = TotalBread.ToString("F")
Try
PriceWings = CInt(txtQtyWings.Text)
Catch ex As Exception
MsgBox("The value you entered for the quantify " & _
"of orders of buffalo wings is not valid" & _
vbCrLf & "Please try again!")
End Try
Try
PriceWings = CDbl(txtPriceWings.Text)
Catch ex As Exception
MsgBox("The value you entered for the price " & _
"of buffalo wings is not valid" & _
vbCrLf & "Please try again!")
End Try
TotalWings = QtyWings * PriceWings
txtTotalWings.Text = TotalWings.ToString("F")
Try
QtyCan = CInt(txtQtyCan.Text)
Catch ex As Exception
MsgBox("The value you entered for the " & _
"quantify of soda cans is not valid" & _
vbCrLf & "Please try again!")
End Try
Try
PriceCan = CDbl(txtPriceCan.Text)
Catch ex As Exception
MsgBox("The value you entered for the " & _
"price of soda cans is not valid" & _
vbCrLf & "Please try again!")
End Try
TotalCan = QtyCan * PriceCan
txtTotalCan.Text = TotalCan.ToString("F")
Try
QtySoda20 = CInt(txtQtySoda20.Text)
Catch ex As Exception
MsgBox("The value you entered for the " & _
"quantify of soda 20 Oz. is not valid" & _
vbCrLf & "Please try again!")
End Try
Try
PriceSoda20 = CDbl(txtPriceSoda20.Text)
Catch ex As Exception
MsgBox("The value you entered for the " & _
"price of soda 20 Oz. is not valid" & _
vbCrLf & "Please try again!")
End Try
TotalSoda20 = QtySoda20 * PriceSoda20
txtTotalSoda20.Text = TotalSoda20.ToString("F")
Try
QtySoda2L = CInt(txtQtySoda2L.Text)
Catch ex As Exception
MsgBox("The value you entered for the quantify " & _
"of bottles of soda 2-litter is not valid" & _
vbCrLf & "Please try again!")
End Try
Try
PriceSoda2L = CDbl(txtPriceSoda2L.Text)
Catch ex As Exception
MsgBox("The value you entered for the price " & _
"of a bottle of soda is not valid" & _
vbCrLf & "Please try again!")
End Try
TotalSoda2L = QtySoda2L * PriceSoda2L
txtTotalSoda2L.Text = TotalSoda2L.ToString("F")
Try
QtyOJ = CInt(txtQtyOJ.Text)
Catch ex As Exception
MsgBox("The value you entered for the quantify " & _
"of a bottle of orange juice is not valid" & _
vbCrLf & "Please try again!")
End Try
Try
PriceOJ = CDbl(txtPriceOJ.Text)
Catch ex As Exception
MsgBox("The value you entered for the price " & _
"of bottles of orange is not valid" & _
vbCrLf & "Please try again!")
End Try
TotalOJ = QtyOJ * PriceOJ
txtTotalOJ.Text = TotalOJ.ToString("F")
Try
QtyWater = CInt(txtQtyWater.Text)
Catch ex As Exception
MsgBox("The value you entered for the quantify " & _
"of bottles of water is not valid" & _
vbCrLf & "Please try again!")
End Try
Try
PriceWater = CDbl(txtPriceWater.Text)
Catch ex As Exception
MsgBox("The value you entered for the price " & _
"of bottle of water is not valid" & _
vbCrLf & "Please try again!")
End Try
TotalWater = QtyWater * PriceWater
txtTotalWater.Text = TotalWater.ToString("F")
CalculatePrice()
End Sub
|
- In the Class Name combo box, select btnClose
- In the Method Name combo box, select Click and implement the event
as follows:
Private Sub btnClose_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles btnClose.Click
End
End Sub
|
- Execute the application and test the form. Here is an example:

- Close the form and return to your programming environment
|
The Alignment of a Check Box |
|
By default, the square box of a check control is
positioned to the left side of its accompanying label. Instead of this
default left position, you can change as you wish. The position of the round box with regards to its label is
controlled by the CheckAlign property that of type ContentAlignment. To programmatically set the check alignment of a check
box, you can call the ContentAlignment enumeration and select the
desired value. Here is an example:
Public Sub InitializeComponent()
chkValidate = New CheckBox()
Controls.Add(chkValidate)
chkValidate.CheckAlign = ContentAlignment.MiddleRight
End Sub
|
The Checked State of a Check Box |
|
Instead of being definitely checked, you can let the
user know that the decision of making the statement true or false is not
complete. This means that a check box can display as "half-checked".
In this case the check mark would appear as if it were disabled. This
behavior is controlled through the CheckState property. To provide
this functionality, assign the Indeterminate value to its CheckState
property. You can do this programmatically as follows:
Public Sub InitializeComponent()
chkValidate = New CheckBox()
Controls.Add(chkValidate)
chkValidate.CheckState = CheckState.Indeterminate
End Sub
|
 |
The CheckState property only allows setting the check
box control as "undecided". If you actually want the user to
control three states of the control as checked, half-checked, or
unchecked, use the ThreeState property.
By setting the CheckState Boolean property
to true, the user can click it two to three times to get the desired
value. When this ability is given to the user, you can use or check
the value of the Indeterminate property to find out whether the control is
checked, half-checked, or unchecked.
Here is an example of specifying the
check box control as being able to display one of three states:
Public Sub InitializeComponent()
chkValidate = New CheckBox()
Controls.Add(chkValidate)
chkValidate.CheckAlign = ContentAlignment.MiddleRight
chkValidate.CheckState = CheckState.Indeterminate
chkValidate.ThreeState = True
End Sub
If a check box is configured to assume one of three states when it's clicked,
that is, if the ThreeState property of a check button is set to True,
when the user clicks such a button, the button acquires one of the available
three states, which are Checked, Unchecked, or Indeterminate. This causes the
control to fire a CheckStateChanged event. This event also is of type EventArgs.
This means that it does not let you know the current state of the button. You
would have to find it out yourself, which is easily done by getting the value of
the CheckState property.
|
The Appearance of a Check Box |
|
By default, a check box appears as a square
box that gets a check mark when the user clicks it.
Optionally, you can make a check box appear as a toggle button. In
that case, the button would appear as a regular button. When the user
clicks it, it appears down. If the user clicks it again, it becomes up.
To
change the appearance of a check box, assign the Button or Normal
value to its Appearance property. The Appearance values are
defined in the Appearance enumeration. You can also do this
programmatically as follows:
Public Sub InitializeComponent()
chkValidate = New CheckBox()
chkValidate.Appearance = Appearance.Button
Controls.Add(chkValidate)
End Sub
Like the radio button, the check box control fires an AppearanceChanged
event when the button's appearance changes from Normal to Button
or vice-versa.
|
Practical Learning: Using the Appearance of a Check Box
|
|
- To start a new application, on the main menu, click File -> New
Project...
- In the Templates list, click Windows Application and set the name to
Logic1
- Click OK
- Design the form as follows:
 |
| Control |
Text |
Name |
Font |
FlatStyle |
Appearance |
| Label |
A |
|
Microsoft Sans Serif, 24pt |
|
|
| Label |
B |
|
Microsoft Sans Serif, 24pt |
|
|
| Label |
A ^ B |
lblOperation |
Microsoft Sans Serif, 24pt |
|
|
| CheckBox |
False |
chkOperand1 |
Microsoft Sans Serif, 18pt |
System |
Button |
| CheckBox |
False |
chkOperand2 |
Microsoft Sans Serif, 18pt |
System |
Button |
| CheckBox |
False |
chkResult |
Microsoft Sans Serif, 18pt |
System |
Button |
| Button |
New Operation |
btnNewOperation |
Microsoft Sans Serif, 15.75pt |
|
|
| Button |
Check |
btnCheckOperation |
Microsoft Sans Serif, 18pt |
|
|
| Button |
Close |
btnClose |
Microsoft Sans Serif, 15.75pt |
|
|
|
- Double-click the top-left (False) button and implement its event as follows:
Private Sub chkOperand1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles chkOperand1.CheckedChanged
If chkOperand1.Checked = True Then
chkOperand1.Text = "True"
Else
chkOperand1.Text = "False"
End If
End Sub
|
- In the Class Name combo box, select chkOperand2
- In the Method Name combo box, select CheckedChanged and implement its event as follows:
Private Sub chkOperand2_CheckedChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles chkOperand2.CheckedChanged
If chkOperand2.Checked = True Then
chkOperand2.Text = "True"
Else
chkOperand2.Text = "False"
End If
End Sub
|
- In the Class Name combo box, select chkResult
- In the Method Name combo box, select CheckedChanged and implement its event as follows:
Private Sub chkResult_CheckedChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles chkResult.CheckedChanged
If chkResult.Checked = True Then
chkResult.Text = "True"
Else
chkResult.Text = "False"
End If
End Sub
|
- In the Class Name combo box, select btnNewOperation
- In the Method Name combo box, select Click and implement its event as follows:
Private Sub btnNewOperation_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles btnNewOperation.Click
Dim strBooleanValues As String() = {"True", "False"}
Dim strOperations As String() = {"A ^ B", "A V B"}
Dim rndNumber As Random = New Random()
chkOperand1.Text = strBooleanValues(rndNumber.Next(2))
chkOperand2.Text = strBooleanValues(rndNumber.Next(2))
If chkOperand1.Text = "True" Then
chkOperand1.Checked = True
Else
chkOperand1.Checked = False
End If
If chkOperand2.Text = "True" Then
chkOperand2.Checked = True
Else
chkOperand2.Checked = False
End If
lblOperation.Text = strOperations(rndNumber.Next(2))
End Sub
|
- In the Class Name combo box, select btnCheckResult
- In the Method Name combo box, select Click and implement its event as follows:
Private Sub btnCheckResult_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles btnCheckResult.Click
' Logical Conjunction
If lblOperation.Text = "A ^ B" Then
' If A = true
If chkOperand1.Checked = True Then
If chkOperand2.Checked = True Then
If chkResult.Checked = True Then
' | A | B | A ^ B |
' | T | T | T |
MsgBox("Bravo - Good Answer")
ElseIf chkResult.Checked = False Then
' | A | B | A ^ B |
' | T | T | F |
MsgBox("Wrong - Get it right next time!")
End If
ElseIf chkOperand2.Checked = False Then
If chkResult.Checked = False Then
' | A | B | A ^ B |
' | T | F | F |
MsgBox("Bravo - Good Answer")
ElseIf chkResult.Checked = True Then
' | A | B | A ^ B |
' | T | F | T |
MsgBox("Wrong - Get it right next time!")
End If
End If
ElseIf chkOperand1.Checked = False Then
If chkOperand2.Checked = True Then
If chkResult.Checked = False Then
' | A | B | A ^ B |
' | F | T | F |
MsgBox("Bravo - Good Answer")
ElseIf chkResult.Checked = True Then
' | A | B | A ^ B |
' | F | T | T |
MsgBox("Wrong - Get it right next time!")
End If
ElseIf chkOperand2.Checked = False Then
If chkResult.Checked = False Then
' | A | B | A ^ B |
' | F | F | F |
MsgBox("Bravo - Good Answer")
ElseIf chkResult.Checked = True Then
' | A | B | A ^ B |
' | F | F | T |
MsgBox("Wrong - Get it right next time!")
End If
End If
End If
End If
If lblOperation.Text = "A V B" Then ' Logical Disjunction
' If A = true
If chkOperand1.Checked = True Then
If chkOperand2.Checked = True Then
If chkResult.Checked = True Then
' | A | B | A V B |
' | T | T | T |
MsgBox("Bravo - Good Answer")
ElseIf chkResult.Checked = False Then
' | A | B | A V B |
' | T | T | F |
MsgBox("Wrong - Get it right next time!")
End If
ElseIf chkOperand2.Checked = False Then
If chkResult.Checked = True Then
' | A | B | A V B |
' | T | F | T |
MsgBox("Bravo - Good Answer")
ElseIf chkResult.Checked = False Then
' | A | B | A V B |
' | T | F | F |
MsgBox("Wrong - Get it right next time!")
End If
End If
ElseIf chkOperand1.Checked = False Then
If chkOperand2.Checked = True Then
If chkResult.Checked = True Then
' | A | B | A V B |
' | F | T | T |
MsgBox("Bravo - Good Answer")
ElseIf chkResult.Checked = False Then
' | A | B | A V B |
' | F | T | F |
MsgBox("Wrong - Get it right next time!")
End If
ElseIf chkOperand2.Checked = False Then
If chkResult.Checked = False Then
' | A | B | A V B |
' | F | F | F |
MsgBox("Wrong - Get it right next time!")
ElseIf chkResult.Checked = True Then
' | A | B | A V B |
' | F | F | T |
MsgBox("Wrong - Get it right next time!")
End If
End If
End If
End If
End Sub
|
- In the Class Name combo box, select btnClose
- In the Method Name combo box, select Click and implement its event as follows:
Private Sub btnClose_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles btnClose.Click
End
End Sub
|
- Return to the form
|
|