Selamat pagi sobat, kali ini saya akan membahas cara membuat aplikasi penjualan dengan menggunakan VB 10, atau mau yang sudah jadi silahkan download disini
, kalo mau membuat sendiri silahkan ikuti tutorial dibawah ini.
hal ini sangat penting sekali terutama untuk sobat yang sedang menjalani proses Kuliah terutama jurusan pemrograman, Ok,,, sesuai dengan tugas kuliah saya membuat aplikasi penjualan pada Tugas KP saya dan alhamdulialh dapat nilai baik, hehe
OK. langsung aja sob, sebelum kita melangkah ke Source Code atau pengkodingan, terlebih dahulu harus membuat tampilan login untuk memulai masuk aplikasi yang akan kita buat,
buat pada form 1 seperti pada gambar dibawah
soal desain terserah agan mau seperti apa yang penting menggunakan 2 textbox dan 2 button,
apabila login berhasil maka akan tampil seperti gambar dibawah
ini adalah tampilan pada form 2 yang di desain untuk tampilan menu utama, selanjutnya kita lihat tampilan form transaksi
nah ketiga tampilan diatas ini adalah aplikasi yang telah saya buat, dan bisa dikembangkan lagi oleh agan sesuai keinginan, oke,,, dibawah ini adalah Source Code Aplikasi lengkap, dan apabila ada masalah silahkan tinggalkan komentar, tapi apabila ingin yang tinggal pake(sudah jadi) sms aja 081320227976
Sebelum lihat Source Code tonton dulu video tutorial dibawah ini
https://www.youtube.com/watch?v=yyQ8EuCLGLE&feature=youtu.be
Berikut Source Code Aplikasi Penjualan dengan VB 10
, kalo mau membuat sendiri silahkan ikuti tutorial dibawah ini.
hal ini sangat penting sekali terutama untuk sobat yang sedang menjalani proses Kuliah terutama jurusan pemrograman, Ok,,, sesuai dengan tugas kuliah saya membuat aplikasi penjualan pada Tugas KP saya dan alhamdulialh dapat nilai baik, hehe
OK. langsung aja sob, sebelum kita melangkah ke Source Code atau pengkodingan, terlebih dahulu harus membuat tampilan login untuk memulai masuk aplikasi yang akan kita buat,
buat pada form 1 seperti pada gambar dibawah
soal desain terserah agan mau seperti apa yang penting menggunakan 2 textbox dan 2 button,
apabila login berhasil maka akan tampil seperti gambar dibawah
ini adalah tampilan pada form 2 yang di desain untuk tampilan menu utama, selanjutnya kita lihat tampilan form transaksi
nah ketiga tampilan diatas ini adalah aplikasi yang telah saya buat, dan bisa dikembangkan lagi oleh agan sesuai keinginan, oke,,, dibawah ini adalah Source Code Aplikasi lengkap, dan apabila ada masalah silahkan tinggalkan komentar, tapi apabila ingin yang tinggal pake(sudah jadi) sms aja 081320227976
Sebelum lihat Source Code tonton dulu video tutorial dibawah ini
https://www.youtube.com/watch?v=yyQ8EuCLGLE&feature=youtu.be
Berikut Source Code Aplikasi Penjualan dengan VB 10
Form 1 :
Public Class Form1
Private Sub Button1_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
Form2.Show()
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
Form3.Show()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
Form4.Show()
End Sub
Private Sub Button4_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
Form5.Show()
End Sub
Private Sub TransaksiToolStripMenuItem_Click_1(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles TransaksiToolStripMenuItem.Click
Form4.Show()
End Sub
Private Sub InputKodeBarangToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles InputKodeBarangToolStripMenuItem.Click
Form2.Show()
End Sub
Private Sub InputDataBarangToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles InputDataBarangToolStripMenuItem.Click
Form3.Show()
End Sub
Private Sub LaporanToolStripMenuItem_Click_1(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles LaporanToolStripMenuItem.Click
Form5.Show()
End Sub
Private Sub KeluarToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles KeluarToolStripMenuItem.Click
If MessageBox.Show("Yakin
mau keluar dari aplikasi ini..?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
End
End If
End Sub
Private Sub Button5_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button5.Click
If MessageBox.Show("Yakin
Anda mau keluar dari aplikasi ini..?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
End
End If
End Sub
End Class
Form 2
Imports
System.Data.OleDb
Public Class Form2
Sub
Kosong()
TextBox1.Clear()
TextBox2.Clear()
TextBox1.Focus()
End Sub
Sub Isi()
TextBox2.Clear()
TextBox2.Focus()
End Sub
Sub
TampilJenis()
da = New
OleDbDataAdapter("Select
* From Jenis", Conn)
ds = New
DataSet
ds.Clear()
da.Fill(ds, "Jenis")
DataGridView1.DataSource = ds.Tables("Jenis")
DataGridView1.Refresh()
End Sub
Sub
AturGrid()
DataGridView1.Columns(0).Width = 250
DataGridView1.Columns(1).Width = 300
DataGridView1.Columns(0).HeaderText = "KODE BARANG"
DataGridView1.Columns(1).HeaderText = "NAMA BARANG"
End Sub
Private Sub Form2_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles
Me.Load
Call
Koneksi()
Call
TampilJenis()
Call
Kosong()
Call
AturGrid()
End Sub
Private Sub TextBox2_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs)
TextBox2.MaxLength = 50
If
e.KeyChar = Chr(13) Then
TextBox2.Text =
UCase(TextBox2.Text)
End If
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
Handles DataGridView1.CellContentClick
Dim i As Integer
i = Me.DataGridView1.CurrentRow.Index
With
DataGridView1.Rows.Item(i)
Me.TextBox1.Text
= .Cells(0).Value
Me.TextBox2.Text
= .Cells(1).Value
End With
End Sub
Private Sub TextBox1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs)
TextBox1.MaxLength = 2
If
e.KeyChar = Chr(13) Then
cmd = New
OleDbCommand("Select
* From Jenis where Jenis='" & TextBox1.Text & "'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows = True Then
TextBox2.Text = rd.Item(1)
TextBox2.Focus()
Else
Call
Isi()
TextBox2.Focus()
End
If
End If
End Sub
Private Sub TextBox3_TextChanged(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
TextBox3.TextChanged
cmd = New
OleDbCommand("Select
* From Jenis where Jenis like '%" & TextBox3.Text & "%'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows Then
da = New
OleDbDataAdapter("Select
* From Jenis where Jenis like '%" & TextBox3.Text & "%'", Conn)
ds = New
DataSet
da.Fill(ds, "Dapat")
DataGridView1.DataSource =
ds.Tables("Dapat")
DataGridView1.ReadOnly = True
Else
MsgBox("Data
tidak ditemukan")
End If
End Sub
Private Sub Button5_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button5.Click
Me.Close()
End Sub
Private Sub Button1_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
If
TextBox1.Text = "" Or TextBox2.Text = ""
Then
MsgBox("Data
belum lengkap..!")
TextBox1.Focus()
Exit Sub
Else
cmd = New
OleDbCommand("Select
* From Jenis where KodeBarang='" & TextBox1.Text & "'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If Not rd.HasRows Then
Dim
Simpan As String
= "insert into Jenis(KodeBarang,Jenis)values
" & _
"('"
& TextBox1.Text & "','"
& TextBox2.Text & "')"
cmd = New
OleDbCommand(Simpan, Conn)
cmd.ExecuteNonQuery()
MsgBox("Simpan
data sukses...!", MsgBoxStyle.Information,
"Perhatian")
End
If
Call
TampilJenis()
Call
Kosong()
TextBox1.Focus()
End If
End Sub
Private Sub Button2_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
If
TextBox1.Text = "" Then
MsgBox("Kode
Barang belum diisi")
TextBox1.Focus()
Exit Sub
Else
Dim
Ubah As String
= "Update Jenis set " & _
"Jenis='"
& TextBox2.Text & "' "
& _
"where
KodeBarang='" & TextBox1.Text & "'"
cmd = New
OleDbCommand(Ubah, Conn)
cmd.ExecuteNonQuery()
MsgBox("Ubah
data sukses..!", MsgBoxStyle.Information,
"Perhatian")
Call
TampilJenis()
Call
Kosong()
TextBox1.Focus()
End If
End Sub
Private Sub Button3_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
If
TextBox1.Text = "" Then
MsgBox("Kode
Barang belum diisi")
TextBox1.Focus()
Exit Sub
Else
If MessageBox.Show("Yakin
akan menghapus Data Jenis " & TextBox1.Text & " ?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
cmd = New
OleDbCommand("Delete
* From Jenis where KodeBarang='" & TextBox1.Text & "'", Conn)
cmd.ExecuteNonQuery()
Call
Kosong()
Call
TampilJenis()
Else
Call
Kosong()
End
If
End If
End Sub
Private Sub Button4_Click_1(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
Call
Kosong()
End Sub
End Class
Form 3
Imports
System.Data.OleDb
Public Class Form3
Sub
Kosong()
TextBox1.Clear()
ComboBox1.Text = ""
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
TextBox1.Focus()
End Sub
Sub Isi()
ComboBox1.Text = ""
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
ComboBox1.Focus()
End Sub
Sub
TampilBarang()
da = New
OleDbDataAdapter("Select
* From Barang", Conn)
ds = New
DataSet
ds.Clear()
da.Fill(ds, "Barang")
DataGridView1.DataSource = ds.Tables("Barang")
DataGridView1.Refresh()
End Sub
Sub
TampilJenis()
cmd = New
OleDbCommand("Select
KodeBarang From Jenis", Conn)
rd = cmd.ExecuteReader
Do While rd.Read
ComboBox1.Items.Add(rd.Item(0))
Loop
End Sub
Sub
AturGrid()
DataGridView1.Columns(0).Width = 70
DataGridView1.Columns(1).Width = 70
DataGridView1.Columns(2).Width = 90
DataGridView1.Columns(3).Width = 70
DataGridView1.Columns(4).Width = 70
DataGridView1.Columns(5).Width = 70
DataGridView1.Columns(6).Width = 70
DataGridView1.Columns(7).Width = 110
DataGridView1.Columns(0).HeaderText = "KODE BARANG"
DataGridView1.Columns(1).HeaderText = "NAMA BARANG"
DataGridView1.Columns(2).HeaderText = "MERK"
DataGridView1.Columns(3).HeaderText = "TYPE BARANG"
DataGridView1.Columns(4).HeaderText = "SALES"
DataGridView1.Columns(5).HeaderText = "JUMLAH"
DataGridView1.Columns(6).HeaderText = "HARGA"
DataGridView1.Columns(7).HeaderText = "DESKRIPSI"
End Sub
Private Sub Form2_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles
Me.Load
Call
Koneksi()
Call
TampilJenis()
Call
TampilBarang()
Call
Kosong()
Call
AturGrid()
End Sub
Private Sub TextBox1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
TextBox1.MaxLength = 3
If
e.KeyChar = Chr(13) Then
cmd = New
OleDbCommand("Select
* From Barang where KodeBarang='" & TextBox1.Text & "'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows = True Then
ComboBox1.Text = rd.Item(1)
TextBox2.Text = rd.Item(2)
TextBox3.Text = rd.Item(3)
TextBox4.Text = rd.Item(4)
TextBox5.Text = rd.Item(5)
TextBox6.Text = rd.Item(6)
TextBox7.Text = rd.Item(7)
TextBox2.Focus()
Else
Call
Isi()
ComboBox1.Focus()
End
If
End If
End Sub
Private Sub TextBox2_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
TextBox2.MaxLength = 50
If
e.KeyChar = Chr(13) Then
TextBox2.Text =
UCase(TextBox2.Text)
TextBox3.Focus()
End If
End Sub
Private Sub TextBox3_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
If
e.KeyChar = Chr(13) Then
TextBox3.Text =
UCase(TextBox3.Text)
TextBox4.Focus()
End If
End Sub
Private Sub ComboBox1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
If
e.KeyChar = Chr(13) Then TextBox2.Focus()
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
Handles DataGridView1.CellContentClick
Dim i As Integer
i = Me.DataGridView1.CurrentRow.Index
With
DataGridView1.Rows.Item(i)
Me.TextBox1.Text
= .Cells(0).Value
Me.ComboBox1.Text
= .Cells(1).Value
Me.TextBox2.Text
= .Cells(2).Value
Me.TextBox3.Text
= .Cells(3).Value
Me.TextBox4.Text
= .Cells(4).Value
Me.TextBox5.Text
= .Cells(5).Value
Me.TextBox6.Text
= .Cells(6).Value
Me.TextBox7.Text
= .Cells(7).Value
End With
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
If
TextBox1.Text = "" Or ComboBox1.Text = ""
Or TextBox2.Text = ""
Or TextBox3.Text = ""
Or TextBox4.Text = ""
Or TextBox5.Text = ""
Or TextBox6.Text = ""
Then
MsgBox("Data
yang anda masukan belum lengkap..!")
TextBox1.Focus()
Exit Sub
Else
cmd = New
OleDbCommand("Select
* From Barang where KodeBarang='" & TextBox1.Text & "'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If Not rd.HasRows Then
Dim
Simpan As String
= "insert into Barang(KodeBarang,JenisBarang,Merk,TypeBarang,Sales,Jumlah,Harga,Deskripsi)values
" & _
"('"
& TextBox1.Text & "','"
& TextBox8.Text & "','"
& TextBox2.Text & "','"
& TextBox3.Text & "','"
& TextBox4.Text & "','"
& TextBox5.Text & "','"
& TextBox6.Text & "','"
& TextBox7.Text & "')"
cmd = New
OleDbCommand(Simpan, Conn)
cmd.ExecuteNonQuery()
MsgBox("Simpan
data sukses...!", MsgBoxStyle.Information,
"Perhatian")
End
If
Call
TampilBarang()
Call
Kosong()
TextBox1.Focus()
End If
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
If
TextBox1.Text = "" Then
MsgBox("Kode
Barang belum diisi")
TextBox1.Focus()
Exit Sub
Else
Dim
Ubah As String
= "Update Barang set " & _
"JenisBarang='"
& ComboBox1.Text & "',"
& _
"Merk='"
& TextBox2.Text & "',"
& _
"TypeBarang='"
& TextBox3.Text & "',"
& _
"Sales='"
& TextBox4.Text & "',"
& _
"Jumlah='"
& TextBox5.Text & "',"
& _
"Harga='"
& TextBox6.Text & "',"
& _
"Deskripsi='"
& TextBox7.Text & "' "
& _
"where
KodeBarang='" & TextBox1.Text & "'"
cmd = New
OleDbCommand(Ubah, Conn)
cmd.ExecuteNonQuery()
MsgBox("Ubah
data sukses..!", MsgBoxStyle.Information,
"Perhatian")
Call
TampilBarang()
Call
Kosong()
TextBox1.Focus()
End If
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
If
TextBox1.Text = "" Then
MsgBox("Kode
Barang belum diisi")
TextBox1.Focus()
Exit Sub
Else
If MessageBox.Show("Yakin
akan menghapus Data Barang " & TextBox1.Text & " ?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
cmd = New
OleDbCommand("Delete
* From Barang where KodeBarang='" & TextBox1.Text & "'", Conn)
cmd.ExecuteNonQuery()
Call
Kosong()
Call
TampilBarang()
Else
Call
Kosong()
End
If
End If
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
Call
Kosong()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles ComboBox1.SelectedIndexChanged
cmd = New
OleDbCommand("Select
* From Jenis where KodeBarang='" & ComboBox1.Text & "'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows = True Then
TextBox8.Text = rd.Item(1)
Else
MsgBox("Kode
Barang yang dimasukan tidak terdaftar")
End If
End Sub
Private Sub TextBox4_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If
e.KeyChar = Chr(13) Then
TextBox4.Text =
UCase(TextBox4.Text)
TextBox5.Focus()
End If
End Sub
Private Sub TextBox5_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
If
e.KeyChar = Chr(13) Then TextBox6.Focus()
End Sub
Private Sub TextBox6_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
If e.KeyChar
= Chr(13) Then
TextBox6.Text =
UCase(TextBox6.Text)
TextBox7.Focus()
End If
End Sub
Private Sub Button5_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button5.Click
Me.Close()
End Sub
Private Sub TextBox9_TextChanged(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
TextBox9.TextChanged
cmd = New
OleDbCommand("Select
* From Barang where JenisBarang like '%" & TextBox9.Text & "%'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows Then
da = New
OleDbDataAdapter("Select
* From Barang where JenisBarang like '%" & TextBox9.Text & "%'", Conn)
ds = New
DataSet
da.Fill(ds, "Dapat")
DataGridView1.DataSource = ds.Tables("Dapat")
DataGridView1.ReadOnly = True
Else
MsgBox("Data
tidak ditemukan")
End If
End Sub
Private Sub TextBox7_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress
TextBox6.MaxLength = 225
If
e.KeyChar = Chr(13) Then
TextBox7.Text =
UCase(TextBox7.Text)
Button1.Focus()
End If
End Sub
Private Sub TextBox7_TextChanged(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
TextBox7.TextChanged
End Sub
End Class
Form
4
Imports
System.Data.OleDb
Public Class Form4
Sub
Kosong()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
TextBox9.Clear()
TextBox4.Focus()
End Sub
Sub
TidakAktif()
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
End Sub
Sub
KolomBaru()
DataGridView1.Columns.Add("Kode", "KODE
BARANG")
DataGridView1.Columns.Add("Jenis", "NAMA
BARANG")
DataGridView1.Columns.Add("Merk", "MERK")
DataGridView1.Columns.Add("Harga", "HARGA")
DataGridView1.Columns.Add("Jumlah", "QTY")
DataGridView1.Columns.Add("Total", "SUB
TOTAL")
Call
LebarKolom()
End Sub
Sub
LebarKolom()
DataGridView1.Columns(0).Width = 70
DataGridView1.Columns(1).Width = 100
DataGridView1.Columns(2).Width = 100
DataGridView1.Columns(3).Width = 100
DataGridView1.Columns(4).Width = 50
DataGridView1.Columns(5).Width = 100
End Sub
Private Sub Otomatis()
cmd = New
OleDbCommand("Select
* from Transaksi where NoFaktur in (select max(NoFaktur) from Transaksi) order
by NoFaktur desc", Conn)
Dim
urutan As String
Dim
hitung As Long
rd = cmd.ExecuteReader
rd.Read()
If Not rd.HasRows Then
urutan = "YM"
+ Format(Now, "ddMMyy") + "001"
Else
If
Microsoft.VisualBasic.Mid(rd.GetString(0), 3, 6) <> Format(Now, "ddMMyy") Then
urutan = "YM" + Format(Now, "ddMMyy") + "001"
Else
hitung = Microsoft.VisualBasic.Right(rd.GetString(0),
2) + 1
urutan = "YM" + Format(Now, "ddMMyy") + Microsoft.VisualBasic.Right("000" & hitung, 3)
End
If
End If
TextBox1.Text = urutan
End Sub
Sub
TampilBarang()
cmd = New
OleDbCommand("Select
KodeBarang From Barang", Conn)
rd = cmd.ExecuteReader
End Sub
Private Sub Form4_Activated(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles
Me.Activated
Call
Otomatis()
TextBox2.Text = Today
TextBox3.Text = TimeOfDay
End Sub
Private Sub Form4_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles
Me.Load
Call
Koneksi()
Call
KolomBaru()
Call
Kosong()
Call
TidakAktif()
Call
TampilBarang()
End Sub
Sub
TotalItem()
Dim
HitungItem As Integer
= 0
For I As Integer = 0 To DataGridView1.Rows.Count - 1
HitungItem = HitungItem +
Val(DataGridView1.Rows(I).Cells(4).Value)
TextBox9.Text = HitungItem
Next
End Sub
Sub
TotalHarga()
Dim
HitungHarga As Integer
= 0
For I As Integer = 0 To DataGridView1.Rows.Count - 1
HitungHarga = HitungHarga +
Val(DataGridView1.Rows(I).Cells(5).Value)
TextBox6.Text = HitungHarga
Label10.Text = HitungHarga
Next
End Sub
Sub
HapusBaris()
On Error Resume Next
Dim
Baris As Integer
= DataGridView1.CurrentCell.RowIndex
DataGridView1.Rows(baris).Cells(0).Value = ""
Chr(30)
End Sub
Private Sub DataGridView1_KeyDown(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyEventArgs)
If
e.KeyCode = Keys.Up Then
DataGridView1.CurrentCell =
DataGridView1.Rows(0).Cells(3)
End If
End Sub
Private Sub DataGridView1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs)
On Error Resume Next
If
e.KeyChar = Chr(27) Then
DataGridView1.Rows.RemoveAt(DataGridView1.CurrentCell.RowIndex)
Call
TotalItem()
Call
TotalHarga()
TextBox7.Clear()
TextBox8.Text = ""
End If
End Sub
Private Sub TextBox7_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress
If
e.KeyChar = Chr(13) Then
If
Val(TextBox7.Text) < Val(TextBox6.Text) Then
MsgBox("Pembayaran
kurang")
TextBox8.Text = ""
TextBox7.Focus()
Exit
Sub
ElseIf
Val(TextBox7.Text) = Val(TextBox6.Text) Then
TextBox8.Text = 0
Button1.Focus()
Else
TextBox8.Text =
Val(TextBox7.Text) - Val(TextBox6.Text)
Button1.Focus()
End
If
End If
If Not ((e.KeyChar >= "0"
And e.KeyChar <= "9")
Or e.KeyChar = vbBack) Then
e.Handled() = True
End Sub
Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs)
If
e.Control.GetType.ToString() = "System.Windows.Forms.DataGridViewTextBoxEditingControl"
Then
Dim
c As DataGridViewTextBoxEditingControl
= CType(e.Control, DataGridViewTextBoxEditingControl)
RemoveHandler
c.KeyPress, AddressOf GridViewTextBox_KeyPress
AddHandler
c.KeyPress, AddressOf GridViewTextBox_KeyPress
End If
End Sub
Private Sub GridViewTextBox_KeyPress(ByVal
sender As Object,
ByVal ex As KeyPressEventArgs)
If
DataGridView1.CurrentCell.ColumnIndex = 3 Then
If
((Asc(ex.KeyChar) < 48 Or Asc(ex.KeyChar)
> 57) And Asc(ex.KeyChar) <> 8) Then
ex.Handled = True
End
If
End If
End Sub
Sub kena(ByVal myGrid As DataGrid)
myGrid.CurrentCell = New DataGridCell(1,
1)
End Sub
Private Sub DataGridView1_CellEndEdit1(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
Handles DataGridView1.CellEndEdit
If
e.ColumnIndex = 0 Then
cmd = New
OleDbCommand("select
* from Barang where KodeBarang='" &
DataGridView1.Rows(e.RowIndex).Cells(0).Value & "'",
Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows Then
DataGridView1.Rows(e.RowIndex).Cells(1).Value = rd.Item(1)
DataGridView1.Rows(e.RowIndex).Cells(2).Value = rd.Item(2)
DataGridView1.Rows(e.RowIndex).Cells(3).Value = rd.Item(6)
DataGridView1.Rows(e.RowIndex).Cells(4).Value = 1
DataGridView1.Rows(e.RowIndex).Cells(5).Value
= DataGridView1.Rows(e.RowIndex).Cells(3).Value *
DataGridView1.Rows(e.RowIndex).Cells(4).Value
Call
TotalItem()
Call
TotalHarga()
Else
MsgBox("Maaf..!
Kode barang tidak terdaftar")
End
If
End If
If
e.ColumnIndex = 4 Then
cmd = New
OleDbCommand("select
* from Barang where KodeBarang='" &
DataGridView1.Rows(e.RowIndex).Cells(0).Value & "'",
Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows Then
If
DataGridView1.Rows(e.RowIndex).Cells(4).Value > rd.Item(5) Then
MsgBox("Stok Barang hanya ada " &
rd.Item(5) & "")
DataGridView1.Rows(e.RowIndex).Cells(4).Value = 1
DataGridView1.Rows(e.RowIndex).Cells(5).Value =
DataGridView1.Rows(e.RowIndex).Cells(3).Value *
DataGridView1.Rows(e.RowIndex).Cells(4).Value
Call
TotalItem()
Call
TotalHarga()
Else
DataGridView1.Rows(e.RowIndex).Cells(5).Value =
DataGridView1.Rows(e.RowIndex).Cells(3).Value *
DataGridView1.Rows(e.RowIndex).Cells(4).Value
Call
TotalItem()
Call
TotalHarga()
End
If
End
If
DataGridView1.CurrentCell =
DataGridView1.Rows(0).Cells(0)
End If
End Sub
Private Sub TextBox4_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If
e.KeyChar = Chr(13) Then
TextBox4.Text =
UCase(TextBox4.Text)
TextBox5.Focus()
End If
End Sub
Private Sub TextBox5_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
If
e.KeyChar = Chr(13) Then
TextBox5.Text =
UCase(TextBox5.Text)
DataGridView1.Focus()
End If
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs)
Form3.ShowDialog()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs)
Me.Close()
End Sub
Private Sub PrintPriviewToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles PrintPriviewToolStripMenuItem.Click
Me.VBPBNPrintForm.PrinterSettings
= Me.VBPBNPrintDialog.PrinterSettings
Me.VBPBNPrintForm.PrintAction
= Printing.PrintAction.PrintToPreview
Me.VBPBNPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
End Sub
Private Sub PrintToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles PrintToolStripMenuItem.Click
If
VBPBNPrintDialog.ShowDialog = Windows.Forms.DialogResult.OK
Then
PrintDocument1.Print()
End If
Try
Me.VBPBNPrintForm.PrinterSettings
= Me.VBPBNPrintDialog.PrinterSettings
Me.VBPBNMenuStrip.Visible = False
Me.VBPBNPrintForm.PrintAction
= Printing.PrintAction.PrintToPrinter
Me.VBPBNPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
Catch
ex As Exception
Finally
Me.VBPBNMenuStrip.Visible
= True
End Try
If
TextBox1.Text = "" Or TextBox2.Text = ""
Or TextBox3.Text = ""
Or TextBox4.Text = ""
Or TextBox5.Text = ""
Or TextBox6.Text = ""
Or TextBox7.Text = ""
Or TextBox8.Text = ""
Then
MsgBox("Data
belum lengkap, tidak ada transaksi atau pembayaran masih kosong")
Exit Sub
End If
'Simpan ke
tabel Transaksi
Dim
SimpanTransaksi As String
= "Insert into Transaksi(NoFaktur,Tanggal,Pukul,NamaPembeli,NoTelp,Total,Bayar,Kembali,Item)
values " & _
"('"
& TextBox1.Text & "','"
& TextBox2.Text & "','"
& TextBox3.Text & "','"
& TextBox4.Text & "','"
& TextBox5.Text & "','"
& TextBox6.Text & "','"
& TextBox7.Text & "','"
& TextBox8.Text & "','"
& TextBox9.Text & "')"
cmd = New
OleDbCommand(SimpanTransaksi, Conn)
cmd.ExecuteNonQuery()
For
baris As Integer
= 0 To DataGridView1.Rows.Count - 10
'Simpan
ke tabel DetailTransaksi
Dim
SimpanDetailTransaksi As String = "Insert
into DetailTransaksi (NoFaktur,KodeBarang,JenisBarang,Harga,Jumlah,SubTotal)
values " & _
"('"
& TextBox1.Text & "','"
& DataGridView1.Rows(baris).Cells(0).Value & "','"
& DataGridView1.Rows(baris).Cells(1).Value & "','"
& DataGridView1.Rows(baris).Cells(2).Value & "','"
& DataGridView1.Rows(baris).Cells(3).Value & "','"
& DataGridView1.Rows(baris).Cells(4).Value & "')"
cmd = New
OleDbCommand(SimpanDetailTransaksi, Conn)
cmd.ExecuteNonQuery()
'Kurangi
stok Barang
cmd = New
OleDbCommand("select
* from Barang where KodeBarang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'",
Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows Then
Dim
KurangiStok As String
= "update Barang set Jumlah= '"
& rd.Item(5) - DataGridView1.Rows(baris).Cells(4).Value & "' where KodeBarang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'"
cmd = New
OleDbCommand(KurangiStok, Conn)
cmd.ExecuteNonQuery()
MsgBox("Simpan
data sukses...!", MsgBoxStyle.Information,
"Perhatian")
End
If
Next
baris
DataGridView1.Columns.Clear()
Call KolomBaru()
Call
Otomatis()
Call
Kosong()
End Sub
Private Sub SimpanToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles SimpanToolStripMenuItem.Click
If
TextBox1.Text = "" Or TextBox2.Text = ""
Or TextBox3.Text = ""
Or TextBox4.Text = ""
Or TextBox5.Text = ""
Or TextBox6.Text = ""
Or TextBox7.Text = ""
Or TextBox8.Text = ""
Then
MsgBox("Data
belum lengkap, tidak ada transaksi atau pembayaran masih kosong")
Exit Sub
End If
'Simpan ke
tabel Transaksi
Dim
SimpanTransaksi As String
= "Insert into
Transaksi(NoFaktur,Tanggal,Pukul,NamaPembeli,NoTelp,Total,Bayar,Kembali,Item)
values " & _
"('"
& TextBox1.Text & "','"
& TextBox2.Text & "','"
& TextBox3.Text & "','"
& TextBox4.Text & "','"
& TextBox5.Text & "','"
& TextBox6.Text & "','"
& TextBox7.Text & "','"
& TextBox8.Text & "','"
& TextBox9.Text & "')"
cmd = New
OleDbCommand(SimpanTransaksi, Conn)
cmd.ExecuteNonQuery()
For
baris As Integer
= 0 To DataGridView1.Rows.Count - 10
'Simpan
ke tabel DetailTransaksi
Dim
SimpanDetailTransaksi As String = "Insert
into DetailTransaksi (NoFaktur,KodeBarang,JenisBarang,Harga,Jumlah,SubTotal)
values " & _
"('"
& TextBox1.Text & "','"
& DataGridView1.Rows(baris).Cells(0).Value & "','"
& DataGridView1.Rows(baris).Cells(1).Value & "','"
& DataGridView1.Rows(baris).Cells(2).Value & "','"
& DataGridView1.Rows(baris).Cells(3).Value & "','"
& DataGridView1.Rows(baris).Cells(4).Value & "')"
cmd = New
OleDbCommand(SimpanDetailTransaksi, Conn)
cmd.ExecuteNonQuery()
'Kurangi
stok Barang
cmd = New
OleDbCommand("select
* from Barang where KodeBarang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'",
Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows Then
Dim
KurangiStok As String
= "update Barang set Jumlah= '"
& rd.Item(5) - DataGridView1.Rows(baris).Cells(4).Value & "' where KodeBarang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'"
cmd = New
OleDbCommand(KurangiStok, Conn)
cmd.ExecuteNonQuery()
MsgBox("Simpan
data sukses...!", MsgBoxStyle.Information,
"Perhatian")
End
If
Next
baris
DataGridView1.Columns.Clear()
Call
KolomBaru()
Call
Otomatis()
Call
Kosong()
End Sub
Private Sub BatalToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles BatalToolStripMenuItem.Click
Call
Kosong()
DataGridView1.Columns.Clear()
Call
KolomBaru()
DataGridView1.Focus()
End Sub
Private Sub
LihatKodeBarangToolStripMenuItem_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
LihatKodeBarangToolStripMenuItem.Click
Form3.ShowDialog()
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
If MessageBox.Show("Apakah
mau mencetak faktur..?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
End If
Try
Me.VBPBNPrintForm.PrinterSettings
= Me.VBPBNPrintDialog.PrinterSettings
Me.VBPBNMenuStrip.Visible
= False
Me.VBPBNPrintForm.PrintAction
= Printing.PrintAction.PrintToPrinter
Me.VBPBNPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
Catch
ex As Exception
Finally
Me.VBPBNMenuStrip.Visible
= True
End Try
If
TextBox1.Text = "" Or TextBox2.Text = ""
Or TextBox3.Text = ""
Or TextBox4.Text = ""
Or TextBox5.Text = ""
Or TextBox6.Text = ""
Or TextBox7.Text = ""
Or TextBox8.Text = ""
Then
MsgBox("Data
belum lengkap, tidak ada transaksi atau pembayaran masih kosong")
Exit Sub
End If
'Simpan ke
tabel Transaksi
Dim
SimpanTransaksi As String
= "Insert into
Transaksi(NoFaktur,Tanggal,Pukul,NamaPembeli,NoTelp,Total,Bayar,Kembali,Item)
values " & _
"('"
& TextBox1.Text & "','"
& TextBox2.Text & "','"
& TextBox3.Text & "','"
& TextBox4.Text & "','"
& TextBox5.Text & "','"
& TextBox6.Text & "','"
& TextBox7.Text & "','"
& TextBox8.Text & "','"
& TextBox9.Text & "')"
cmd = New
OleDbCommand(SimpanTransaksi, Conn)
cmd.ExecuteNonQuery()
For
baris As Integer
= 0 To DataGridView1.Rows.Count - 10
'Simpan
ke tabel DetailTransaksi
Dim
SimpanDetailTransaksi As String = "Insert
into DetailTransaksi (NoFaktur,KodeBarang,JenisBarang,Harga,Jumlah,SubTotal)
values " & _
"('"
& TextBox1.Text & "','"
& DataGridView1.Rows(baris).Cells(0).Value & "','"
& DataGridView1.Rows(baris).Cells(1).Value & "','"
& DataGridView1.Rows(baris).Cells(2).Value & "','"
& DataGridView1.Rows(baris).Cells(3).Value & "','"
& DataGridView1.Rows(baris).Cells(4).Value & "')"
cmd = New
OleDbCommand(SimpanDetailTransaksi, Conn)
cmd.ExecuteNonQuery()
'Kurangi
stok Barang
cmd = New
OleDbCommand("select
* from Barang where KodeBarang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'",
Conn)
rd = cmd.ExecuteReader
rd.Read()
If
rd.HasRows Then
Dim
KurangiStok As String
= "update Barang set Jumlah= '"
& rd.Item(5) - DataGridView1.Rows(baris).Cells(4).Value & "' where KodeBarang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'"
cmd = New
OleDbCommand(KurangiStok, Conn)
cmd.ExecuteNonQuery()
MsgBox("Simpan
data sukses...!", MsgBoxStyle.Information,
"Perhatian")
End
If
Next
baris
DataGridView1.Columns.Clear()
Call
KolomBaru()
Call
Otomatis()
Call
Kosong()
End Sub
Private Sub PageSetupToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles PageSetupToolStripMenuItem.Click
PageSetupDialog1.Document =
PrintDocument1
PageSetupDialog1.Document.DefaultPageSettings.Color = False
PageSetupDialog1.ShowDialog()
End Sub
Private Sub TutupToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles TutupToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub TutupToolStripMenuItem1_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles TutupToolStripMenuItem1.Click
Me.Close()
End Sub
End Class
Form 5
Imports System.Data.OleDb
Public Class Form5
Sub
TampilTransaksi()
da = New
OleDbDataAdapter("Select
* From Transaksi", Conn)
ds = New
DataSet
ds.Clear()
da.Fill(ds, "Transaksi")
DataGridView1.DataSource = ds.Tables("Transaksi")
DataGridView1.Refresh()
End Sub
Sub
AturGrid()
DataGridView1.Columns(0).Width = 80
DataGridView1.Columns(1).Width = 70
DataGridView1.Columns(2).Width = 100
DataGridView1.Columns(3).Width = 100
DataGridView1.Columns(4).Width = 100
DataGridView1.Columns(5).Width = 70
DataGridView1.Columns(6).Width = 70
DataGridView1.Columns(7).Width = 70
DataGridView1.Columns(8).Width = 40
DataGridView1.Columns(0).HeaderText = "NOMOR FAKTUR"
DataGridView1.Columns(1).HeaderText = "TANGGAL FAKTUR"
DataGridView1.Columns(2).HeaderText = "PUKUL"
DataGridView1.Columns(3).HeaderText = "NAMA PEMBELI"
DataGridView1.Columns(4).HeaderText = "NO TELP"
DataGridView1.Columns(5).HeaderText = "SUB TOTAL"
DataGridView1.Columns(6).HeaderText = "BAYAR"
DataGridView1.Columns(7).HeaderText = "KEMBALI"
DataGridView1.Columns(8).HeaderText = "ITEM"
End Sub
Private Sub Form5_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles
Me.Load
Call
Koneksi()
Call
TampilTransaksi()
Call
AturGrid()
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
Handles DataGridView1.CellContentClick
Dim i As Integer
i = Me.DataGridView1.CurrentRow.Index
With
DataGridView1.Rows.Item(i)
Me.TextBox1.Text
= .Cells(0).Value
End With
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs)
Me.Close()
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs)
If
TextBox1.Text = "" Then
MsgBox("Nomor
Faktur yang akan dihapus belum dimasukan ..!")
TextBox1.Focus()
Exit Sub
Else
If MessageBox.Show("Yakin
akan menghapus Nomor Faktur " & TextBox1.Text & " ?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
cmd = New
OleDbCommand("Delete
* From Transaksi where NoFaktur='" & TextBox1.Text & "'", Conn)
cmd.ExecuteNonQuery()
Call
TampilTransaksi()
Else
End
If
End If
End Sub
Private Sub PrintPriviewToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles PrintPriviewToolStripMenuItem.Click
Me.VBPBNPrintForm.PrinterSettings
= Me.VBPBNPrintDialog.PrinterSettings
Me.VBPBNPrintForm.PrintAction
= Printing.PrintAction.PrintToPreview
Me.VBPBNPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
End Sub
Private Sub PrintToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles PrintToolStripMenuItem.Click
If
VBPBNPrintDialog.ShowDialog = Windows.Forms.DialogResult.OK
Then
PrintDocument1.Print()
End If
Try
Me.VBPBNPrintForm.PrinterSettings
= Me.VBPBNPrintDialog.PrinterSettings
Me.VBPBNMenuStrip.Visible
= False
|
Me.VBPBNPrintForm.PrintAction =
Printing.PrintAction.PrintToPrinter
Me.VBPBNPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
Catch
ex As Exception
Finally
Me.VBPBNMenuStrip.Visible
= True
End Try
End Sub
Private Sub TutupToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles TutupToolStripMenuItem.Click
PageSetupDialog1.Document =
PrintDocument1
PageSetupDialog1.Document.DefaultPageSettings.Color = False
PageSetupDialog1.ShowDialog()
End Sub
Private Sub TutupToolStripMenuItem2_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles TutupToolStripMenuItem2.Click
Me.Close()
End Sub
Private Sub CetakToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles CetakToolStripMenuItem.Click
Try
Me.VBPBNPrintForm.PrinterSettings
= Me.VBPBNPrintDialog.PrinterSettings
Me.VBPBNMenuStrip.Visible
= False
Me.VBPBNPrintForm.PrintAction
= Printing.PrintAction.PrintToPrinter
Me.VBPBNPrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
Catch
ex As Exception
Finally
Me.VBPBNMenuStrip.Visible
= True
End Try
End Sub
Private Sub HapusToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles HapusToolStripMenuItem.Click
If
TextBox1.Text = "" Then
MsgBox("Nomor
Faktur yang akan dihapus belum dimasukan ..!")
TextBox1.Focus()
Exit Sub
Else
If MessageBox.Show("Yakin
akan menghapus Nomor Faktur " & TextBox1.Text & " ?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
cmd = New
OleDbCommand("Delete
* From Transaksi where NoFaktur='" & TextBox1.Text & "'", Conn)
cmd.ExecuteNonQuery()
Call
TampilTransaksi()
Else
End
If
End If
End Sub
Private Sub TutupToolStripMenuItem1_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles TutupToolStripMenuItem1.Click
Me.Close()
End Sub
End Class
Form 6
Public Class Form6
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
End
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Timer1.Tick
If
TextBox1.Text = "yaya" And TextBox2.Text = "1234"
Then
ProgressBar1.Increment(10)
If
ProgressBar1.Value = ProgressBar1.Maximum Then
Timer1.Stop()
ProgressBar1.Value = 0
MsgBox("Login
Berhasil", MsgBoxStyle.Information)
Form1.Show()
End
If
Else
Timer1.Start()
ProgressBar1.Increment(10)
If
ProgressBar1.Value = ProgressBar1.Maximum Then
Timer1.Stop()
ProgressBar1.Value = 0
MsgBox("User
atau Password salah", MsgBoxStyle.Critical)
End
If
End If
End Sub
End Class
Tidak ada komentar:
Posting Komentar