Sabtu, 25 Oktober 2014

belajar Visual Basic





Private Sub biad_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
tobi.Text = Val(bitran.Text) + Val(biad.Text)
End If
End Sub

Private Sub Check1_Click()
horn.Text = "15000"
horn2.SetFocus
End Sub

Private Sub Check2_Click()
fleser.Text = "15000"
fles2.SetFocus
End Sub

Private Sub Check3_Click()
speedo.Text = "25000"
speedo2.SetFocus
End Sub

Private Sub Check4_Click()
stater.Text = "25000"
stater2.SetFocus
End Sub

Private Sub Combo1_Click()
Select Case (Combo1.Text)
Case "1201"
nampet.Text = "Ali"
Case "1202"
nampet.Text = "Malik"
Case "1203"
nampet.Text = "Hadi"
End Select
End Sub

Private Sub Command1_Click()
jml2.Text = Val((horn.Text) * Val(horn2.Text)) + Val((fleser.Text) * Val(fles2.Text))
End Sub

Private Sub Command2_Click()
bitran.Text = Val(jml1.Text) + Val(jml2.Text)
End Sub

Private Sub Command3_Click()
jml1.Text = Val((speedo.Text) * Val(speedo2.Text)) + Val((stater.Text) * Val(stater2.Text))
End Sub

Private Sub Command4_Click()
Combo1.Enabled = True
Check1.Enabled = True
waktu
horn2.Enabled = True
fles2.Enabled = True
speedo2.Enabled = True
stater2.Enabled = True
Check2.Enabled = True
Check3.Enabled = True
Check4.Enabled = True
Option1.Enabled = True
Option2.Enabled = True
Option3.Enabled = True
Option1 = False
Option2 = False
Option3 = False
Check1 = False
Check2 = False
Check3 = False
Check4 = False
horn.Text = ""
horn2.Text = ""
fleser.Text = ""
fles2.Text = ""
jml2.Text = ""
jml1.Text = ""
speedo.Text = ""
speedo2.Text = ""
stater.Text = ""
stater2.Text = ""
biad.Text = ""
bitran.Text = ""
tobi.Text = ""
Combo1 = "Pilih NIP"
nampet.Text = ""
End Sub
Sub waktu()
tgl.Text = Format(Date, "dddd dd, mmmm, yyyy")
jam.Text = Format(Time, "h:m:s")

End Sub

Private Sub Command5_Click()
p = MsgBox("Anda yakin ingin keluar ?", vbYesNo, "Keluar")
If p = vbYes Then
End
End If
End Sub

Private Sub Form_Activate()
Combo1.Enabled = False
nampet.Enabled = False
tgl.Enabled = False
jam.Enabled = False
Check1.Enabled = False
Check2.Enabled = False
Check3.Enabled = False
Check4.Enabled = False
horn.Enabled = False
fleser.Enabled = False
jml1.Enabled = False
jml2.Enabled = False
speedo.Enabled = False
stater.Enabled = False
horn2.Enabled = False
fles2.Enabled = False
speedo2.Enabled = False
stater2.Enabled = False
bitran.Enabled = False
Option1.Enabled = False
Option2.Enabled = False
Option3.Enabled = False
tobi.Enabled = False
End Sub


Private Sub Option1_Click()
biad.Text = "10000"
biad.SetFocus
End Sub

Private Sub Option2_Click()
biad.Text = "5000"
biad.SetFocus
End Sub

Private Sub Option3_Click()
biad.Text = "8500"
biad.SetFocus
End Sub

Kamis, 09 Oktober 2014

Pemrograman Visual 1


Private Sub cmdbel_Click()
Combo1.Text = "Pilih Kode Barang"
txtjumbel.Text = ""
txttot.Text = ""
txtubay.Text = ""
txtukem.Text = ""
txtmerk.Text = ""
txthrga.Text = ""
txtstock.Text = ""


End Sub




Private Sub cmdhit_Click()
txttot.Text = Val(txtjumbel.Text) * Val(txthrga.Text)

End Sub

Private Sub Combo1_Click()
If Combo1.Text = "C01" Then
txtmerk.Text = "Pepsodent"
txthrga.Text = "6000"
txtstock.Text = "100"
txtjumbel.SetFocus

ElseIf Combo1.Text = "C02" Then
txtmerk.Text = "Close Up"
txthrga.Text = "5000"
txtstock.Text = "200"
txtjumbel.SetFocus

Else
txtmerk.Text = "Enzim"
txthrga.Text = "8000"
txtstock.Text = "400"
txtjumbel.SetFocus

End If

End Sub

Private Sub Form_Load()
txtmerk.Enabled = False
txtstock.Enabled = False
txthrga.Enabled = False
txttot.Enabled = False
txtukem.Enabled = False


End Sub

Private Sub Timer1_Timer()
lbltgl.Caption = Format(Date, "dddd, dd mmmm yyyy")
lbljam.Caption = Format(Time, "h:m:s")

End Sub

Private Sub txtjumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttot.Text = Val(txtjumbel.Text) * Val(txthrga.Text)
txtubay.SetFocus

End If

End Sub

Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtukem.Text = Val(txtubay.Text) - Val(txttot.Text)
End If

End Sub