1. Aktifkan aplikasi VB.NET
2. Buat database pada Microsoft Office Access
- untuk form 1
- Untuk form 2
- Untuk fom 3
4. Lalu masukkan kodingan pada setiap form nya :
- Kodingan Form 1
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "husna" And TextBox2.Text = "1" Then
MessageBox.Show("Anda berhasil Login", "husna", MessageBoxButtons.OK, MessageBoxIcon.Information)
Form2.Visible = True
Me.Visible = False
Else
MessageBox.Show("Maaf Salah Password", "husna", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Application.Exit()
End Sub
End Class
- Kodingan form 2
Public Class Form2
Private Sub TokoKueToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TokoKueToolStripMenuItem.Click
Form3.MdiParent = Me
Form3.Show()
End Sub
Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click
Application.Exit()
End Sub
End Class
- Kodingan form 3
Imports System.Data.OleDb
Public Class Form3Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OpenDB()
Dim alamat = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = database3.mdb"
DB = New OleDbConnection(alamat)
If DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub menampilkanCari()
ADP = New OleDbDataAdapter("SELECT * FROM tblkue where kode = '" & ComboBox1.Text & "'", DB)
DS = New DataSet
ADP.Fill(DS, "tblkue")
DataGridView1.DataSource = DS.Tables("tblkue")
End Sub
Sub TampilRecordKue()
ADP = New OleDbDataAdapter("SELECT * FROM tblkue", DB)
DS = New DataSet
ADP.Fill(DS, "tblkue")
DataGridView1.DataSource = DS.Tables("tblkue")
End Sub
Sub HapusText()
TextBox1.Text = ""
ComboBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call OpenDB()
Call HapusText()
Call TampilRecordKue()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.Text = "blo" Then TextBox1.Text = "kue bolu"
If ComboBox1.Text = "tar" Then TextBox1.Text = "kue tar"
If ComboBox1.Text = "brw" Then TextBox1.Text = "kue brownis"
If ComboBox1.Text = "lps" Then TextBox1.Text = "kue lapis"
If ComboBox1.Text = "dnt" Then TextBox1.Text = "kue donat"
If ComboBox1.Text = "blo" Then TextBox2.Text = "50000"
If ComboBox1.Text = "tar" Then TextBox2.Text = "60000"
If ComboBox1.Text = "brw" Then TextBox2.Text = "70000"
If ComboBox1.Text = "lps" Then TextBox2.Text = "30000"
If ComboBox1.Text = "dnt" Then TextBox2.Text = "15000"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SQL = "INSERT INTO tblkue(Kode, jenis, harga, nama, alamat) " & _
" values('" & ComboBox1.Text & "','" & _
TextBox1.Text & "','" & _
TextBox2.Text & "','" & _
TextBox3.Text & "','" & _
TextBox4.Text & "')"
CMD = New OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call TampilRecordKue()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call HapusText()
ComboBox1.Focus()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
SQL = "DELETE FROM tblkue Where Kode='" & ComboBox1.Text & "'"
CMD = New OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call TampilRecordKue()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
MessageBox.Show("Jika ingin keluar Lewat menu UTAMA", "Admin", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
menampilkanCari()
End Sub
End Class
4. jika sudah maka RUN Program
Ya sekian langkah-langkah membuat database Toko kue pada aplikasi VB.NET , semoga bermanfaat . terimaksih yang sudah membaca blog saya^^
The Most Successful Sites for Crypto, Casino & Poker - Goyang
BalasHapusGoyang worrione Casino & Poker 출장마사지 is one of the most famous and well known crypto gambling sites, founded in 2012. They are apr casino popular because goyangfc.com of their great