1. membuat program 2 bilangan
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
Private Sub Command2_Click()
Text1.SetFocus
Text1 = ” “
Text2 = ” “
Text3 = ” “
End Sub
Private Sub Command3_Click()
End
End Sub
2. membuat program 2 bilangan (part 2)
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub
Private Sub Command2_Click()
Text3.Text = Val(Text1.Text) – Val(Text2.Text)
End Sub
Private Sub Command3_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
Private Sub Command4_Click()
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End Sub
Private Sub Command5_Click()
Text1.SetFocus
Text1 = ” “
Text2 = ” “
Text3 = ” “
End Sub
Private Sub Command6_Click()
End
End Sub
3. membuat font style dan font colot
Private Sub Option1_Click()
lbljudul.ForeColor = vbRed
End Sub
Private Sub Option2_Click()
lbljudul.ForeColor = vbBlue
End Sub
Private Sub Option3_Click()
lbljudul.ForeColor = vbGreen
End Sub
Private Sub Option4_Click()
lbljudul.ForeColor = vbYellow
End Sub
Private Sub Option5_Click()
lbljudul.ForeColor = vbWhite
End Sub
Private Sub Option6_Click()
lbljudul.ForeColor = vbBlack
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
lbljudul.FontBold = True
Else
lbljudul.FontBold = False
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
lbljudul.FontItalic = True
Else
lbljudul.FontItalic = False
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
lbljudul.FontUnderline = True
Else
lbljudul.FontUnderline = False
End If
End Sub
4. membuat program perhitungan diskon
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.Text = Val(Text1.Text) * 0.2
Text3.Text = Val(Text1.Text) – Val(Text2.Text)
End If
End Sub
Private Sub Command1_Click()
Text1.SetFocus
Text1 = ” “
Text2 = ” “
Text3 = ” “
End Sub
Private Sub Command2_Click()
End
End Sub
5. membuat program perhitungan gaji
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.Text = Val(Text1.Text) + Val(Text2.Text) – Val(Text3.Text)
Text5.Text = Val(Text4.Text) * 0.1
Text6.Text = Val(Text4.Text) – Val(Text5.Text)
End If
End Sub
Private Sub Command1_Click()
Text1.SetFocus
Text1 = ” “
Text2 = ” “
Text3 = ” “
Text4 = ” “
Text5 = ” “
Text6 = ” “
End Sub
Private Sub Command2_Click()
End
End Sub