Docstoc

VB Pertemuan 3

Document Sample
VB Pertemuan 3 Powered By Docstoc
					Pertemuan ke 5                          trata.Text = Val(Val(tabs.Text) + Val(ttgs.Text) +
                                        Val(tuts.Text) + Val(tuas.Text)) / 4

                                        If trata >= 90 Then
                                                  tgrd.Text = "A"
                                                  tket.Text = "LULUS"
                                        ElseIf trata >= 80 Then
                                                  tgrd.Text = "B"
                                                  tket.Text = "LULUS"
                                        ElseIf trata >= 70 Then
                                                  tgrd.Text = "C"
KETENTUAN SOAL:                                   tket.Text = "LULUS"
                                        ElseIf trata >= 60 Then
  Rata-rata         Grade
                                                  tgrd.Text = "D"
    > =90             A
                                                  tket.Text = "GAGAL"
    >= 80             B                 Else
    >= 70             C
                                                  tgrd.Text = "E"
    >=60              D
                                                  tket.Text = "GAGAL"
Selain itu Keterangan “GAGAL”.          End If
                                        End Sub
LISTING PROGRAM:
Private Sub cmdbersih_Click()           Private Sub Form_Activate()
tabs.Text = ""                          cmdproses.Enabled = False
ttgs.Text = ""                          tabs.SetFocus
tuts.Text = ""                          End Sub
tuas.Text = ""
trata.Text = ""                         Private Sub tuas_Change()
tgrd.Text = ""                          cmdproses.Enabled = True
tket.Text = ""                          End Sub
tabs.SetFocus
End Sub

Private Sub cmdkeluar_Click()
If MsgBox("keluar??", vbQuestion +
vbOKCancel, "Konfirmasi") = vbOK Then
End
End If
End Sub

Private Sub cmdproses_Click()
Fungsi Standar                                         txtTotal.Text = Format(total, "Rp #,###.#0")
                                                      txtFaktur.Text = UCase(faktur)
Latihan 3                                            End Sub

                                                     Private Sub cmdReset_Click()
                                                       Dim ctrl As Control

                                                       For Each ctrl In Me
                                                         If TypeName(ctrl) = "TextBox"
                                                     Then
                                                            ctrl.Text = ""
                                                         End If
                                                       Next ctrl

                                                       txtKode.SetFocus
                                                     End Sub

                                                     Private Sub Timer1_Timer()
                                                     Label2.Caption = Format(Now(), "hh:mm:ss")
                                                     Label3.Caption = Format(Now(), "dd/MM/yyyy")
                                                     End Sub
Listing
Dim faktur, kode, nama, tanggal As
String
                                                     Latihan
Dim jumlah As Byte
Dim harga, total As Currency

Private Sub cmdHitung_Click()
  kode = txtKode.Text
  nama = txtNama.Text
   tanggal = Format(Now(), "dd/MM/yy")

   ' Kode Faktur: FJ-MM-yy-kk-nn
   ' FJ = Faktur jual
   ' MM = Bulan jual, 2 digit
   ' yy = Tahun jual, 2 digit
   ' kk = Kode barang, 2 digit
   ' nn = Nama barang, 2 digit

faktur = "FJ" & "-" & Mid(tanggal, 4, 2) & "-" & _
Right(tanggal, 2) & "-" & Left(kode, 2) & "-" & _
Left(nama, 2)

jumlah = Val(txtJumlah.Text)
harga = Val(txtHarga.Text)
  Let total = jumlah * harga
Latihan 4

                                              Private Sub Option4_Click()
                                                 harga = 50000
                                                txtHarga.Text = Format(harga, "#,###.#0")
                                              End Sub

                                              Private Sub opteko_Click()
                                              txtkode.Text =
                                              UCase(Left(cmbnama.Text, 2) & "-
                                              EKO-" & Right(cmbnama.Text, 2))
                                              End Sub
Ketentuan :
 Jurusan                       Harga          Private Sub optvip_Click()
 Jakarta – Solo                150.000        txtkode.Text =
 Jakarta – Yogyakarta          200.000        UCase(Left(cmbnama.Text, 2) & "-VIP-
 Jakarta – Cirebon             100.000        " & Right(cmbnama.Text, 2))
 Jakarta – Bandung             50.000         End Sub

Properties                                    Private Sub optvvip_Click()
Cmbnama : Lorena, Primajasa, Hiba             txtkode.Text =
utama                                         UCase(Left(cmbnama.Text, 2) & "-
Format Kode bus :                             VVIP-" & Right(cmbnama.Text, 2))
Namabus-kelas-namabus                         End Sub
Ex: Primajasa VIP = PR-VIP-SA
                                              Private Sub cmdHitung_Click()
                                                Dim total As Currency
Listing
Dim harga As Currency                           total = harga * Val(txtJumlah.Text)
                                                txtTotal = Format(total, "#,###.#0")
Private Sub Option1_Click()                   End Sub
   harga = 150000
  txtHarga.Text = Format(harga, "#,###.#0")   Private Sub cmdReset_Click()
End Sub                                          Option1.Value = False
                                                 Option2.Value = False
Private Sub Option2_Click()                      Option3.Value = False
   harga = 200000                                Option4.Value = False
  txtHarga.Text = Format(harga, "#,###.#0")
End Sub                                         txtHarga.Text = ""
                                                txtJumlah.Text = ""
Private Sub Option3_Click()                     txtTotal.Text = ""
   harga = 100000                             End Sub
  txtHarga.Text = Format(harga, "#,###.#0")
End Sub
 Private Sub cmdTutup_Click()                      Let txtMerk.Text = "SAMSUNG"
   MsgBox "Terima kasih.",                         Let txtNama.Text = "Mesin Cuci"
 vbInformation, "Agen Bus"                         Let h = 3000000
   Unload Me                                     Case "TV2000TH"
 End Sub                                           Let txtMerk.Text = "TOSHIBA"
                                                   Let txtNama.Text = "TV 21 inc"
 Latihan 4                                         Let h = 2500000
                                                 End Select

                                                 Let txtHarga.Text = Format(h,
                                               "#,###.#0")
                                                 txtJumlah.SetFocus
                                               End Sub

                                               Private Sub cmdbersih_Click()
                                                 Dim ctrl As Control

                                                  For Each ctrl In Me
                                                     If TypeOf ctrl Is TextBox Then
                                               ctrl.Text = ""
                                                     'If TypeOf ctrl Is ComboBox Then
                                               ctrl.Text = ""
 Ketentuan                                           If TypeOf ctrl Is CheckBox Then
Kode       Merk        Nama          Harga     ctrl.Value = 0
AC1000LG     LG        AIR           1000000      Next ctrl
                       CONDITIONER             End Sub
LE4500TH     THOSIBA   LEMARI ES     5000000
MC2500SM     SAMSUNG   MESIN CUCI    3000000
TV2000TH     THOSIBA   TV 21 inc     2500000   Private Sub cmdkeluar_Click()
                                                 Dim tombol As Byte
 Listing :
                                                 Let tombol = MsgBox("Akhiri
 Dim d, h, s, t As Currency                    program?", vbYesNo + vbQuestion,
                                               "Konfirmasi")
 Private Sub Combo1_Click()                      If tombol = vbYes Then Unload Me
   Select Case Combo1.Text                     End Sub
   Case "AC1000LG"
      Let txtMerk.Text = "LG"                  Private Sub Form_Initialize()
      Let txtNama.Text = "AIR                    Combo1.AddItem "AC1000LG"
 CONDITIONER"                                    Combo1.AddItem "LE4500TH"
      Let h = 1000000                            Combo1.AddItem "MC2500SM"
   Case "LE4500TH"                               Combo1.AddItem "TV2000TH"
      Let txtMerk.Text = "TOSHIBA"             End Sub
      Let txtNama.Text = "Lemari Es"
      Let h = 5000000
   Case "MC2500SM"
Private Sub                                 Case Else
txtBayar_KeyPress(KeyAscii As                 Let Check1.Value = 0
Integer)                                      Let Check2.Value = 0
   Dim k, u As Currency                       Let Check3.Value = 0
                                            End Select
  Select Case KeyAscii
  Case Is = 8                               Select Case s
  Case Is = 13                              Case Is > 2500000
    Let u = Val(txtBayar.Text)                Let d = (s * 3) / 100
    Let k = u - t                           Case Is > 5000000
                                              Let d = (s * 5) / 100
     If (k < 0) Then                        Case Is > 7500000
           txtKembali.ForeColor = vbRed       Let d = (s * 7) / 100
        Let txtKembali.Text = "Uang         Case Is > 10000000
Anda kurang..."                               Let d = (s * 10) / 100
     Else                                   Case Else
        Let txtKembali.Text = Format(k,       Let d = 0
"#,###.#0")                                 End Select
     End If
  Case Is < 47                              Let t = s - d
     KeyAscii = 0                           Let txtSub.Text = Format(s,
  Case Is > 58                            "#,###.#0")
     KeyAscii = 0                           Let txtDiskon.Text = Format(d,
  End Select                              "#,###.#0")
End Sub                                     Let txtTotal.Text = Format(t,
                                          "#,###.#0")
Private Sub txtJumlah_Change()            End Sub
  Dim j As Byte
                                          Private Sub
  Let j = Val(txtJumlah.Text)             txtJumlah_KeyPress(KeyAscii As
  Let s = j * h                           Integer)
                                             If ((KeyAscii < 47) Or (KeyAscii >
  Select Case j                           58)) And (KeyAscii <> 8) Then
  Case Is >= 8                                  KeyAscii = 0
    Let Check1.Value = 1                     End If
    Let Check2.Value = 0                  End Sub
    Let Check3.Value = 0
  Case Is >= 5
    Let Check1.Value = 0
    Let Check2.Value = 1
    Let Check3.Value = 0
  Case Is >= 2
    Let Check1.Value = 0
    Let Check2.Value = 0
    Let Check3.Value = 1

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:99
posted:9/1/2010
language:Indonesian
pages:5