Professional Documents
Culture Documents
'BukaDB()
Call bersihform(Me)
Call aktifkanobjek(Me)
Call nonaktifobjek(Me)
validasitombol(True, False, False, False, False, True)
End Sub
Private Sub tblbaru_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tblbaru.Click
kode.Enabled = True
kode.Focus()
validasitombol(False, True, False, False, True, True)
End Sub
Private Sub tblsimpan_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tblsimpan.Click
Call prosesdb(1)
End Sub
Private Sub tbledit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tbledit.Click
Call prosesdb(2)
End Sub
Private Sub tblhapus_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tblhapus.Click
Call prosesdb(3)
End Sub
Private Sub tblbatal_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tblbatal.Click
Call bersihform(Me)
Call nonaktifobjek(Me)
validasitombol(True, False, False, False, False, True)
End Sub
Private Sub tblkeluar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tblkeluar.Click
End
End Sub
Private Sub kode_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles kode.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
If kode.Text = "" Then
MsgBox("kode_TBS Harus Di isi", MsgBoxStyle.Exclamation, "isi")
kode.Focus()
Else
sql = "select * from data_krani where kode_TBS='" & kode.Text & "'"
End Try
End Sub
Sub ClearForm(ByVal f As Form)
Dim ctl As Control
For Each ctl In f.Controls
If TypeOf ctl Is TextBox Then ctl.Text = ""
If TypeOf ctl Is ComboBox Then ctl.Text = ""
Next
End Sub
Sub bersihform(ByVal f As Form)
Dim x As Control
For Each x In f.Controls
If TypeOf x Is TextBox Then x.Text = ""
If TypeOf x Is ComboBox Then x.Text = ""
Next
End Sub
Sub aktifkanobjek(ByVal f As Form)
Dim x As Control
For Each x In f.Controls
If TypeOf x Is TextBox Then x.Enabled = True
If TypeOf x Is ComboBox Then x.Enabled = True
Next
End Sub
Sub nonaktifobjek(ByVal f As Form)
Dim x As Control
For Each x In f.Controls
If TypeOf x Is TextBox Then x.Enabled = False
If TypeOf x Is ComboBox Then x.Enabled = False
Next
End Sub
End Module
End Sub
Private Sub password_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles password.KeyPress
If Asc(e.KeyChar) = 13 Then
If password.Text = xpass Then
Else
MsgBox("password salah", MsgBoxStyle.Information, "password")
password.Text = ""
password.Focus()
End If
End If
End Sub
Private Sub BtnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnLogin.Click
Form5.Show()
If xuser = "user" Then
Form5.DataKraniToolStripMenuItem.Enabled = True
Form5.DataProduksiToolStripMenuItem.Enabled = True
Form5.PROSESToolStripMenuItem.Enabled = True
Form5.LapDataKraniToolStripMenuItem.Enabled = True
Form5.LAPORANToolStripMenuItem.Enabled = True
Form5.LapProduksiToolStripMenuItem.Enabled = True
Else
Form5.DataKraniToolStripMenuItem.Enabled = True
Form5.DataProduksiToolStripMenuItem.Enabled = True
Form5.PROSESToolStripMenuItem.Enabled = True
Form5.LapDataKraniToolStripMenuItem.Enabled = True
Form5.LAPORANToolStripMenuItem.Enabled = True
Form5.LapProduksiToolStripMenuItem.Enabled = True
End If
End Sub
Private Sub Btnkeluar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Btnkeluar.Click
Me.Close()
End Sub
End Class
Imports MySql.Data.MySqlClient
Public Class Form5
Private Sub KELUARToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
KELUARToolStripMenuItem.Click
End
End Sub
Private Sub DataKraniToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DataKraniToolStripMenuItem.Click
Dim fkrani As Form1 = New Form1
fkrani.MdiParent = Me
fkrani.Show()
End Sub
Private Sub LapDataKraniToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
LapDataKraniToolStripMenuItem.Click
Dim fdata_krani As Form3 = New Form3
fdata_krani.MdiParent = Me
fdata_krani.Show()
End Sub
Private Sub DataProduksiToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DataProduksiToolStripMenuItem.Click
Dim fdata As Form2 = New Form2
fdata.MdiParent = Me
fdata.Show()
End Sub
Private Sub LapProduksiToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
LapProduksiToolStripMenuItem.Click
Dim fdataproduksi As Form4 = New Form4
fdataproduksi.MdiParent = Me
fdataproduksi.Show()
End Sub
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
BukaDB()
End Sub
End Class
6. Masukan Database