Pages

Jumat, 04 Maret 2011

Tugas Membuat Aplikasi Sederhana (Apotek) menggunakan VB



Sebelum anda memasuki apikasi VB apotek anda harus login terlebih dahulu.
Langkah 1 :
Buatlah 4 command button  untuk mengisi daftar  Password,User,Login,Clear dan Exit.
Langkah 2 :
Buatlah 2 text box untuk mengisi tampilan dari Password dan User.
Langkah 3 :
Masukkan Image untuk gambar Login.
Langkah 4 :
Codinglah aplikasi Login tersebut.

 
Penjelasan Coding :

Private Sub Command1_Click()
If Text1.Text = "admin" And Text2.Text = "password" Then
Form2transaksi.Show
Unload Me
Else
MsgBox "Maaf Yang anda Masukkan Salah!!"
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub text1_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii = 13 Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeySpace) Then
KeyAscii = 0
End If
If KeyAscii = 13 Then
    If Text1.Text = "" Then
    Text1.SetFocus
    Else
    Text2.SetFocus
    End If
End If
End Sub
Private Sub text2_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii = 13 Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeySpace) Then
KeyAscii = 0
End If
If KeyAscii = 13 Then
If Text2.Text = "" Then
Text2.SetFocus
Else
Command1.SetFocus
End If
End If
End Sub






Private Sub cmdproses_Click()
If Combo1.Text = "analsik" Then
text4.Text = 5000 * Val(text1.Text)
ElseIf Combo1.Text = "Antalgin" Then
text4.Text = 2000 * Val(text1.Text)
ElseIf Combo1.Text = "Bodrex" Then
text4.Text = 1000 * Val(text1.Text)
ElseIf Combo1.Text = "entrostop" Then
text4.Text = 1500 * Val(text1.Text)
ElseIf Combo1.Text = "feminax" Then
text4.Text = 2500 * Val(text1.Text)
End If
If Combo2.Text = "albothyl" Then
text6.Text = 20000 * Val(text5.Text)
ElseIf Combo2.Text = "biolysin" Then
text6.Text = 10000 * Val(text5.Text)
ElseIf Combo2.Text = "curcumaplus" Then
text6.Text = 14550 * Val(text5.Text)
ElseIf Combo2.Text = "hufagrip" Then
text6.Text = 15000 * Val(text5.Text)
ElseIf Combo2.Text = "laserin" Then
text6.Text = 12500 * Val(text5.Text)
End If
If Combo3.Text = "diapet" Then
text2.Text = 2000 * Val(text3.Text)
ElseIf Combo3.Text = "captopril" Then
text2.Text = 5000 * Val(text3.Text)
ElseIf Combo3.Text = "sangobion" Then
text2.Text = 5000 * Val(text3.Text)
ElseIf Combo3.Text = "fatigon" Then
text2.Text = 4000 * Val(text3.Text)
ElseIf Combo3.Text = "supravit" Then
text2.Text = 16000 * Val(text3.Text)
End If
txttotal.Text = Val(text2.Text) + Val(text4.Text) + Val(text6.Text)
txtkembalian.Text = Val(txtpembayaran.Text) - Val(txttotal.Text)
End Sub

Private Sub Command3_Click()
If text2.Text & text4.Text & text6.Text Then
txttotal.Text = Val(text2.Text) + Val(text4.Text) + Val(text6.Text)
Else
txttotal.Text = ""
End If
End Sub

Private Sub Command1_Click()
text1.Text = ""
text2.Text = ""
text3.Text = ""
text4.Text = ""
text5.Text = ""
text6.Text = ""
txttotal.Text = ""
txtpembayaran.Text = ""
txtkembalian.Text = ""
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Combo1.AddItem "analsik"
Combo1.AddItem "antalgim"
Combo1.AddItem "bodrex"
Combo1.AddItem "entrostop"
Combo1.AddItem "feminax"
Combo2.AddItem "albothyl"
Combo2.AddItem "biolysin"
Combo2.AddItem "curcumaplus"
Combo2.AddItem "hufagrip"
Combo2.AddItem "kiranti"
Combo2.AddItem "laserin"
Combo3.AddItem "diapet"
Combo3.AddItem "captropil"
Combo3.AddItem "sangobiono"
Combo3.AddItem "fatigon"
Combo3.AddItem "supravit"
Combo4.AddItem "2 * sehari 1 tablet"
Combo4.AddItem "1 * sehari 1 tablet"
Combo4.AddItem "2 * sehari 1 tablet"
Combo4.AddItem "1 * sehari 1 tablet"
Combo4.AddItem "1 * sehari 1 tablet"
Combo5.AddItem "2 * sehari 1 tetes"
Combo5.AddItem "3 * sehari 1 sendok"
Combo5.AddItem "2 * sehari 1 sendok"
Combo5.AddItem "1 * sehari 1 sendok"
Combo5.AddItem "1 * sehari 1 sendok"
Combo6.AddItem "2 * sehari 1 kapsul"
Combo6.AddItem "1 * sehari 2 kapsul"
Combo6.AddItem "3 * sehari 1 kapsul"
Combo6.AddItem "1 * sehari 1 kapsul"
Combo6.AddItem "2 * sehari 1 kapsul"
Combo7.AddItem "113487"
Combo7.AddItem "114789"
Combo7.AddItem "119871"
Combo7.AddItem "113425"
Combo7.AddItem "115623"
Combo8.AddItem "114789"
Combo8.AddItem "114789"
Combo8.AddItem "114789"
Combo8.AddItem "114789"
Combo8.AddItem "114789"
Combo7.AddItem "114789"
Combo7.AddItem "114789"
Combo7.AddItem "114789"
Combo7.AddItem "114789"
Combo7.AddItem "114789"

End Sub

0 komentar:

Posting Komentar