Contoh Aplikasi VB [Pengolahan Lapangan Futsal]

2 Mar

Visual Basic

VB Tutorial

Private Sub
Form_Load()
Lapangan.AddItem "Matras"
Lapangan.AddItem "Reguler"
Lapangan.AddItem "Sintetis"
Tgl.AddItem "1"
Tgl.AddItem "2"
Tgl.AddItem "3"
Tgl.AddItem "4"
Tgl.AddItem "5"
Tgl.AddItem "6"
Tgl.AddItem "7"
Tgl.AddItem "8"
Tgl.AddItem "9"
Tgl.AddItem "10"
Tgl.AddItem "11"
Tgl.AddItem "12"
Tgl.AddItem "13"
Tgl.AddItem "14"
Tgl.AddItem "15"
Tgl.AddItem "16"
Tgl.AddItem "17"
Tgl.AddItem "18"
Tgl.AddItem "19"
Tgl.AddItem "20"
Tgl.AddItem "21"
Tgl.AddItem "22"
Tgl.AddItem "23"
Tgl.AddItem "24"
Tgl.AddItem "25"
Tgl.AddItem "26"
Tgl.AddItem "27"
Tgl.AddItem "28"
Tgl.AddItem "29"
Tgl.AddItem "30"
Tgl.AddItem "31"
Bulan.AddItem "Januari"
Bulan.AddItem "Februari"
Bulan.AddItem "Maret"
Bulan.AddItem "April"
Bulan.AddItem "Mei"
Bulan.AddItem "Juni"
Bulan.AddItem "Juli"
Bulan.AddItem "Agustus"
Bulan.AddItem "September"
Bulan.AddItem "Oktober"
Bulan.AddItem "November"
Bulan.AddItem "Desember"
Tahun.AddItem "2010"
Tahun.AddItem "2011"
Tahun.AddItem "2012"
Tahun.AddItem "2013"
End Sub
Private Sub Tgl_Click()
Bulan.SetFocus
End Sub
Private Sub Bulan_Click()
Tahun.SetFocus
End Sub
Private Sub
Tahun_Click()
No.SetFocus
End Sub
Private Sub No_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Nama.SetFocus
End If
End Sub
Private Sub Nama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Lama.SetFocus
End If
End Sub
Private Sub Lama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Sepatu.SetFocus
End If
End Sub
Private Sub Sepatu_Click()
If Sepatu.Value = Checked Then
Text_sepatu = 50000
Else
Text_sepatu = 0
End If
End Sub
Private Sub Kostum_Click()
If Kostum.Value = Checked Then
Text_kostum = 45000
Else
Text_kostum = 0
End If
End Sub
Private Sub Lapangan_Click()
If Indoor.Value = True Then
  If Lapangan = "Matras" Then
  Biaya = 200000
  ElseIf Lapangan = "Reguler" Then
  Biaya = 300000
  Else
  Biaya = 350000
  End If
Else
  If Lapangan = "Matras" Then
  Biaya = 150000
  ElseIf Lapangan = "Reguler" Then
  Biaya = 200000
  Else
  Biaya = 250000
  End If
End If
Hitung.SetFocus
End Sub
Private Sub Hitung_Click()
Total = (Val(Text_sepatu) * Val(Lama)) + (Val(Text_kostum) * Val(Lama)) + (Val(Biaya) * Val(Lama))
Bayar.SetFocus
End Sub
Private Sub Bayar_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  If Val(Bayar) < Val(Total) Then
  MsgBox ("Uang Bayar Kurang!")
  Bayar = ""
  Else
  Kembali = Val(Bayar) - Val(Total)
  Ulangi.SetFocus
  End If
End If
End Sub
Private Sub Ulangi_Click()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Text = ""
End If
Next
Tgl = "Tgl"
Bulan = "Bulan"
Tahun = "Tahun"
Lapangan = "= Pilih ="
Indoor.Value = False
Outdoor.Value = False
Sepatu.Value = False
Kostum.Value = False
Tgl.SetFocus
End Sub

Private Sub Keluar_Click()
y = MsgBox("Yakin akan keluar?", vbQuestion + vbYesNo)
If y = vbYes Then
Unload Me
End If 
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: