Wednesday, May 21, 2014

Luas Segitiga ala Sang Bocah

Option Compare Database

Private Sub CboAlas_Change()
  LblAlas.Caption = CoboAlas
End Sub

Private Sub CboTinggi_Change()
  LblTinggi.Caption = CboTinggi
End Sub

Private Sub CmdHapus_Click()
  CboAlas = ""
  CboTinggi = ""
  TxtHasil = ""
  LblAlas.Caption = "Isi Alas"
  LblTinggi.Caption = "Isi Tinggi"
  CboAlas.SetFocus
End Sub

Private Sub CmdHitung_Click()
  If CboAlas = "" Or CboTinggi = "" Then
    MsgBox ("Isi nilai Alas dan Tinggi")
   Else
    Alas = CboAlas
    Tinggi = CboTinggi
    Hasil = (Alas * Tinggi) / 2
    TxtHasil = Hasil
  End If
End Sub

Private Sub CmdKeluar_Click()
  DoCmd.Save
  DoCmd.Close
End Sub

Private Sub Form_Load()
  Dim i As Integer
   CboAlas = ""
   CboTinggi = ""
   TxtHasil = ""
   For i = 1 To 20
     CboAlas.AddItem i
     CboTinggi.AddItem i
    Next i
End Sub

0 comments:

Post a Comment