Tugas 3 Visual Basic

VB1

Private Sub Command1_Click()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

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

VB 2

Private Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub

Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub

Private Sub Command1_Click()
Label2.Caption = Text1.Text
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub

Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub

VB3

Private Sub Command1_Click()
If (Check1.Value = 1) And (Check2.Value = 1) And (Check3.Value = 1) Then
Text1.FontBold = True
Text1.FontItalic = True
Text1.FontUnderline = True
ElseIf (Check1.Value = 1) And (Check2.Value = 1) And (Check3.Value = 0) Then
Text1.FontBold = True
Text1.FontItalic = True
Text1.FontUnderline = False
ElseIf (Check1.Value = 1) And (Check2.Value = 0) And (Check3.Value = 1) Then
Text1.FontBold = True
Text1.FontItalic = False
Text1.FontUnderline = True
ElseIf (Check1.Value = 1) And (Check2.Value = 0) And (Check3.Value = 0) Then
Text1.FontBold = True
Text1.FontItalic = False
Text1.FontUnderline = False
ElseIf (Check1.Value = 0) And (Check2.Value = 1) And (Check3.Value = 1) Then
Text1.FontBold = False
Text1.FontItalic = True
Text1.FontUnderline = True
ElseIf (Check1.Value = 0) And (Check2.Value = 1) And (Check3.Value = 0) Then
Text1.FontBold = False
Text1.FontItalic = True
Text1.FontUnderline = False
ElseIf (Check1.Visible = 0) And (Check2.Value = 0) And (Check3.Value = 1) Then
Text1.FontBold = False
Text1.FontItalic = False
Text1.FontUnderline = True
ElseIf (Check1.Value = 0) And (Check2.Value = 0) And (Check3.Value = 0) Then
Text1.FontBold = False
Text1.FontItalic = False
Text1.FontUnderline = False
End If
End Sub

VB 4

Private Sub Command1_Click()
Dim A, B, C As Double
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 = “”
Text2 = “”
Text3 = “”
End Sub

Private Sub Command6_Click()
End
End Sub

VB 5

Private Sub Command1_Click()
Dim hg, jp As Integer
Dim tb As Long
hg = Val(Text3.Text)
jp = Val(Text4.Text)
tb = (hg * jp)
Text5.Text = tb
Text5.SetFocus
End Sub

Private Sub Command2_Click()
Text1.Text = ” ”
Text2.Text = ” ”
Text3.Text = ” ”
Text4.Text = ” ”
Text5.Text = ” ”
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Activate()
Text1.SetFocus
Text1.Text = ” ”
Text2.Text = ” ”
Text3.Text = ” ”
Text4.Text = ” ”
Text5.Text = ” ”
End Sub

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
Text3.SetFocus
End If
End Sub

VB 6

Private Sub cmdhitung_Click()
Dim a, b, c As Double
Text2.Text = Val(Text1.Text) * (0.1)
Text3.Text = Val(Text1.Text) – Val(Text2.Text)
End Sub

Private Sub cmdquit_Click()
Unload Me
End Sub

Private Sub cmdulangi_Click()
Text1.Text = ” ”
Text2.Text = ” ”
Text3.Text = ” ”
End Sub

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
CMDHITUNG.SetFocus
End If
End Sub

VB 7

Private Sub CMDKELUAR_Click()
Unload Me
End Sub

Private Sub CMDPROSES_Click()
Dim A, B, C, D, E, F As Double
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 Sub

Private Sub CMDULANG_Click()
Text1.SetFocus
Text1.Text = ” ”
Text2.Text = ” ”
Text3.Text = ” ”
Text4.Text = ” ”
Text5.Text = ” ”
Text6.Text = ” ”
End Sub

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.SetFocus
End If
End Sub

Private Sub Text4_keypress(keyascii As Integer)
If keyascii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text5_keypress(keyascii As Integer)
If keyascii = 13 Then
Text6.SetFocus
End If
End Sub

VB 8

Private Sub Command1_Click()
Dim Quis, Tgs, UTS, UAS, NA As Integer
Dim Hm As String
Quis = Val(Text3.Text)
Tgs = Val(Text4.Text)
UTS = Val(Text5.Text)
UAS = Val(Text6.Text)
NA = (Quis + Tgs + UTS + UAS) / 4
Text7.Text = NA

Select Case Text7.Text
Case Is > 80
Hm = “A”
Case Is > 70
Hm = “B”
Case Is > 60
Hm = “C”
Case Is > 50
Hm = “D”
Case Is < 50
Hm = “E”
End Select
Text8.Text = Hm
End Sub

Private Sub Combo1_CLICK()
Dim nama, jurusan As String
Select Case Combo1.Text
Case “10100454”
nama = “Abdul Soim”
jurusan = “sistem informasi”
Case “10100150”
nama = “Dedi kurinawan”
jurusan = “sistem informasi”
Case “10100196”
nama = “Dwi yulianingsih”
jurusan = “manajemen informatika”
End Select
Text1.Text = nama
Text2.Text = jurusan
Text3.SetFocus

End Sub

Private Sub Command2_Click()
Text1.SetFocus
Text1.Text = ” ”
Text2.Text = ” ”
Text3.Text = ” ”
Text4.Text = ” ”
Text5.Text = ” ”
Text6.Text = ” ”
Text7.Text = ” ”
End Sub
Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Activate()
Text1.SetFocus
Text1.Text = ” ”
Text2.Text = ” ”
Text3.Text = ” ”
Text4.Text = ” ”
Text5.Text = ” ”
Text6.Text = ” ”
Text7.Text = ” ”
End Sub
Private Sub form_load()
Combo1.AddItem “10100454”
Combo1.AddItem “10100150”
Combo1.AddItem “10100196”
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text7.SetFocus
End If
End Sub

VB 9

Private Sub Combo1_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case Combo1.Text
Case “I”
gapok = 1500000
tunjangan = 150000
Case “II”
gapok = 2000000
tunjangan = 200000
Case “III”
gapok = 2500000
tunjangan = 250000
Case “IV”
gapok = 3000000
tunjangan = 300000
Case Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
Text3.Text = gapok
Text4.Text = tunjangan
Text5.Text = pajak
Text6.Text = total – pajak
End Sub
Public Sub kosong()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Combo1.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub

Private Sub Command1_Click()
kosong
End Sub

Private Sub Command2_Click()
kosong
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Load()
Combo1.AddItem “I”
Combo1.AddItem “II”
Combo1.AddItem “III”
Combo1.AddItem “IV”
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

VB 10

Private Sub Command1_Click()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
End Sub

Private Sub Command2_Click()
Text3.SetFocus
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub

Private Sub Command3_Click()
Text3.SetFocus
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Rancang situs seperti ini dengan WordPress.com
Mulai