APLIKASI SEDERHANA DENGAN VB.NET
Open a new Project and save the Form as CheckBox.frm
and save the Project as CheckBox.vbp
* Design the Form as shown below
Object
|
Property
|
Setting
|
Form | Caption Name |
CheckBox frmCheckBox |
CheckBox | Caption Name |
Bold chkBold |
CheckBox | Caption Name |
Italic chkItalic |
CheckBox | Caption Name |
Underline chkUnderline |
OptionButton | Caption Name |
Red optRed |
OptionButton | Caption Name |
Blue optBlue |
OptionButton | Caption Name |
Green optGreen |
TextBox | Name Text |
txtDisplay (empty) |
CommandButton | Caption Name |
Exit cmdExit |
Following code is typed in the Click() events of the CheckBoxes
Private Sub chkBold_Click()
If chkBold.Value = 1 Then
txtDisplay.FontBold = True
Else
txtDisplay.FontBold = False
End If
End Sub
If chkBold.Value = 1 Then
txtDisplay.FontBold = True
Else
txtDisplay.FontBold = False
End If
End Sub
Private Sub chkItalic_Click()
If chkItalic.Value = 1 Then
txtDisplay.FontItalic = True
Else
txtDisplay.FontItalic = False
End If
End Sub
If chkItalic.Value = 1 Then
txtDisplay.FontItalic = True
Else
txtDisplay.FontItalic = False
End If
End Sub
Private Sub chkUnderline_Click()
If chkUnderline.Value = 1 Then
txtDisplay.FontUnderline = True
Else
txtDisplay.FontUnderline = False
End If
End Sub
Following code is typed in the Click() events of
the OptionButtonsIf chkUnderline.Value = 1 Then
txtDisplay.FontUnderline = True
Else
txtDisplay.FontUnderline = False
End If
End Sub
Private Sub optBlue_Click()
txtDisplay.ForeColor = vbBlue
End Sub
txtDisplay.ForeColor = vbBlue
End Sub
Private Sub optRed_Click()
txtDisplay.ForeColor = vbRed
End Sub
txtDisplay.ForeColor = vbRed
End Sub
Private Sub optGreen_Click()
txtDisplay.ForeColor = vbGreen
End Sub
To terminate the program following code is typed in the
Click() event of the Exit buttontxtDisplay.ForeColor = vbGreen
End Sub
Private Sub cmdExit_Click()
End
End Sub
Run the program by pressing F5. Check the program by clicking on OptionButtons
and CheckBoxes.End
End Sub