MEMBUAT APLIKASI KASIR DENGAN VISUAL BASIC 2010
Kali ini
kita akan membuat aplikasi kasir dengan Visual Basic 2010. Buka program visual
basic 2010, pilih pada Start page pilih New Project, pilih Windows Form
Application. Sesuaikan ukuran form awal seperti gambar berikut atau sesuai
keinginan Anda.
Dari
form yang masih kosong di atas, sesuaikan sehingga terbentuk form seperti di
bawah ini. Gunakan tool yang ada di toolbox untuk memodifikasinya
Keterangan
:
1.
Label
2.
Combobox
3.
Picturebox
4.
Button
5.
Datagridview
6.
Textbox
Untuk
memberikan perintah pada form dan tool – tool tersebut masukkan listing berikut
:
Public Class Form1
Private Sub
ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
If ComboBox1.Text = ("Sepatu
Sepakbola") Then TextBox1.Text = ("250000")
If ComboBox1.Text = ("Sepatu
Sepakbola") Then
PictureBox1.Visible = True
If ComboBox1.Text = ("Sepatu
Sepakbola") Then
PictureBox2.Visible = False
If ComboBox1.Text = ("Sepatu
Sepakbola") Then
PictureBox3.Visible = False
If ComboBox1.Text = ("Sepatu
Sepakbola") Then
PictureBox4.Visible = False
If ComboBox1.Text = ("Sepatu
Sepakbola") Then PictureBox5.Visible
= False
If ComboBox1.Text = ("Sepatu
Basket") Then TextBox1.Text = ("300000")
If ComboBox1.Text = ("Sepatu
Basket") Then PictureBox1.Visible =
False
If ComboBox1.Text = ("Sepatu
Basket") Then PictureBox2.Visible =
True
If ComboBox1.Text = ("Sepatu
Basket") Then PictureBox3.Visible =
False
If ComboBox1.Text = ("Sepatu
Basket") Then PictureBox4.Visible =
False
If ComboBox1.Text = ("Sepatu
Basket") Then PictureBox5.Visible =
False
If ComboBox1.Text = ("Sepatu
Lari") Then TextBox1.Text = ("500000")
If ComboBox1.Text = ("Sepatu
Lari") Then PictureBox1.Visible = False
If ComboBox1.Text = ("Sepatu
Lari") Then PictureBox2.Visible = False
If ComboBox1.Text = ("Sepatu
Lari") Then PictureBox3.Visible = True
If ComboBox1.Text = ("Sepatu
Lari") Then PictureBox4.Visible = False
If ComboBox1.Text = ("Sepatu
Lari") Then PictureBox5.Visible = False
If ComboBox1.Text = ("Sepatu
Tennis") Then TextBox1.Text = ("350000")
If ComboBox1.Text = ("Sepatu
Tennis") Then PictureBox1.Visible =
False
If ComboBox1.Text = ("Sepatu
Tennis") Then PictureBox2.Visible =
False
If ComboBox1.Text = ("Sepatu
Tennis") Then PictureBox3.Visible =
False
If ComboBox1.Text = ("Sepatu
Tennis") Then PictureBox4.Visible =
True
If ComboBox1.Text = ("Sepatu
Tennis") Then PictureBox5.Visible =
False
If ComboBox1.Text = ("Sepatu
Bowling") Then TextBox1.Text = ("400000")
If ComboBox1.Text = ("Sepatu
Bowling") Then PictureBox1.Visible
= False
If ComboBox1.Text = ("Sepatu
Bowling") Then PictureBox2.Visible
= False
If ComboBox1.Text = ("Sepatu
Bowling") Then PictureBox3.Visible
= False
If ComboBox1.Text = ("Sepatu
Bowling") Then PictureBox4.Visible
= False
If ComboBox1.Text = ("Sepatu
Bowling") Then PictureBox5.Visible
= True
End Sub
Private Sub
Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
ComboBox1.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
PictureBox1.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = False
PictureBox4.Visible = False
PictureBox5.Visible = False
End Sub
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim Diskon As Double
Dim Total As Double
Dim Harga As Integer
Dim Jumlah As Integer
Dim Bayar As Integer
Harga
= Val(TextBox1.Text)
Jumlah = Val(TextBox5.Text)
Diskon = Val(TextBox6.Text)
Diskon = (Harga * Jumlah * Diskon) / 100
Total
= ((Harga * Jumlah) - Diskon)
Bayar
= Val(TextBox3.Text)
TextBox2.Text = Total
End Sub
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Dim Diskon As Double
Dim Total As Double
Dim Harga As Integer
Dim Jumlah As Integer
Dim Bayar As Integer
Harga
= Val(TextBox1.Text)
Jumlah = Val(TextBox5.Text)
Diskon = Val(TextBox6.Text)
Diskon = (Harga * Jumlah * Diskon) / 100
Total
= ((Harga * Jumlah) - Diskon)
Bayar
= Val(TextBox3.Text)
TextBox2.Text = Total
TextBox4.Text = Val(TextBox3.Text) - Val(TextBox2.Text)
If TextBox4.Text < 0 Then
MsgBox("Maaf Uang Anda Tidak Cukup")
If TextBox4.Text < 0 Then
TextBox4.Text = ""
End Sub
Private Sub
Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
MsgBox("Terimakash Sudah Membeli Produk
Kami")
Close()
End Sub
Private Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Me.Text = "SPORT
SHOES"
End Sub
Private Sub
TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
TextBox5.TextChanged
If Val(TextBox5.Text) >= ("1")
And Val(TextBox5.Text) <= ("2") Then
TextBox6.Text = ("0")
If Val(TextBox5.Text) >= ("3")
And Val(TextBox5.Text) <= ("5") Then
TextBox6.Text = ("25")
If
Val(TextBox5.Text) >= ("6") And Val(TextBox5.Text) <= ("10") Then
TextBox6.Text = ("50")
If Val(TextBox5.Text) >= ("11")
Then TextBox6.Text = ("75")
End Sub
Private Sub
Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
With Me.DataGridView1.Rows.Add(Me.ComboBox1.Text, Me.TextBox1.Text,
Me.TextBox5.Text, Me.TextBox6.Text,
Me.TextBox2.Text, Me.TextBox3.Text,
Me.TextBox4.Text)
End With
ComboBox1.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
PictureBox1.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = False
PictureBox4.Visible
= False
PictureBox5.Visible = False
End Sub
End Classoleh:http://ti36ieundip2012.blogspot.com/2012/11/tutorial-membuat-mesin-kasir.html
0 komentar:
Posting Komentar