SELANJUTNYA desain sesuai dengan kebutuhan, contohnya seperti gambar ini
LANJUT kodenya seperti ini
KODE TOMBOL PROGRAM COMBO BOX NO. KAMAR
Private Sub cbonokamar_Click()
If cbonokamar.Text = "220" Then
txtmakan.Text = "250"
txtair.Text = "150"
txtlistrik.Text = "100"
ElseIf cbonokamar.Text = "221" Then
txtmakan.Text = "285"
txtair.Text = "120"
txtlistrik.Text = "150"
ElseIf cbonokamar.Text = "222" Then
txtmakan.Text = "200"
txtair.Text = "200"
txtlistrik.Text = "100"
ElseIf cbonokamar.Text = "223" Then
txtmakan.Text = "300"
txtair.Text = "150"
txtlistrik.Text = "150"
End If
txttotal.SetFocus
End Sub
KODE TOMBOL PROGRAM HITUNG
Private Sub cmdhitung_Click()
txttotal.Text = Val(txtmakan.Text) + Val(txtair.Text) + Val(txtlistrik.Text)
End Sub
Private Sub cmdlagi_Click()
txtnama.Text = ""
cbonokamar.Text = ""
txtmakan.Text = ""
txtair.Text = ""
txtlistrik.Text = ""
txttotal.Text = ""
txtnama.SetFocus
End Sub
KODE TOMBOL PROGRAM SELESAI
Private Sub cmdselesai_Click()
Unload Me
End Sub
KODE TOMBOL PROGRAM SUB FORM LOAD
Private Sub Form_Load()
cbonokamar.AddItem "220"
cbonokamar.AddItem "221"
cbonokamar.AddItem "222"
cbonokamar.AddItem "223"
End Sub
TERAKHIR... coba jalankan programnya seperti ini
Sekian dan semoga berkah.. Amin
Jangan lupa like & share
Tidak ada komentar:
Posting Komentar