You are on page 1of 11

Koding di Beranda

Public Class Beranda


Private Sub LogOutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LogOutToolStripMenuItem.Click
Dim response As MsgBoxResult
response = MsgBox("Apakah anda yakin akan keluar dari akun?",
MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Information")
If response = MsgBoxResult.Yes Then
Me.Dispose()
Login.Show()
Login.TextBox1.Text = ""
Login.TextBox2.Text = ""
ElseIf response = MsgBoxResult.No Then
Exit Sub
End If
End Sub

Private Sub InputBukuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles InputBukuToolStripMenuItem.Click
Me.Hide()
input_buku.Show()
End Sub

Private Sub LihatBukuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles LihatBukuToolStripMenuItem.Click
Me.Hide()
lihat_buku.Show()
End Sub

Private Sub InputAnggotaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles InputAnggotaToolStripMenuItem.Click
Me.Hide()
input_anggota.Show()
End Sub

Private Sub LihatAnggotaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles LihatAnggotaToolStripMenuItem.Click
Me.Hide()
lihat_anggota.Show()
End Sub
End Class
Koding di Input Buku

Public Class input_buku


Sub bersih()
Id_bukuTextBox.Text = ""
JudulTextBox.Text = ""
PengarangTextBox.Text = ""
PenerbitTextBox.Text = ""
Kd_isbnTextBox.Text = ""
JumlahTextBox.Text = ""
LokasiTextBox.Text = ""
End Sub

Private Sub T_bukuBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs)
Me.Validate()
Me.T_bukuBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub input_buku_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_buku' table.
You can move, or remove it, as needed.
Me.T_bukuTableAdapter.Fill(Me.PerpustakaanDataSet.t_buku)

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button7.Click
T_bukuBindingSource.MoveNext()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button6.Click
T_bukuBindingSource.MovePrevious()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Try
T_bukuTableAdapter.simpan(Id_bukuTextBox.Text, JudulTextBox.Text,
PengarangTextBox.Text, PenerbitTextBox.Text, Tahun_terbitDateTimePicker.Text,
Kd_isbnTextBox.Text, JumlahTextBox.Text, LokasiTextBox.Text)
Me.T_bukuTableAdapter.Fill(Me.PerpustakaanDataSet.t_buku)
MsgBox("data berhasil disimpan")
Catch ex As Exception
MsgBox("data tidak tersimpan", MsgBoxStyle.Critical, "information")
End Try
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button5.Click
Call bersih()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Try
T_bukuTableAdapter.hapus(Id_bukuTextBox.Text)
Me.T_bukuTableAdapter.Fill(Me.PerpustakaanDataSet.t_buku)
MsgBox("data berhasil dihapus")
Catch ex As Exception
MsgBox("data tidak terhapus", MsgBoxStyle.Critical, "information")
End Try
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Try
T_bukuTableAdapter.edit(Id_bukuTextBox.Text, JudulTextBox.Text,
PengarangTextBox.Text, PenerbitTextBox.Text, Tahun_terbitDateTimePicker.Text,
Kd_isbnTextBox.Text, JumlahTextBox.Text, LokasiTextBox.Text, Id_bukuTextBox.Text)
Me.T_bukuTableAdapter.Fill(Me.PerpustakaanDataSet.t_buku)
MsgBox("data berhasil diubah")
Catch ex As Exception
MsgBox("data tidak terubah", MsgBoxStyle.Critical, "information")
End Try
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button4.Click
Me.Hide()
Beranda.Show()

End Sub
End Class

Koding di Lihat Buku

Public Class lihat_buku

Private Sub T_bukuBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs)
Me.Validate()
Me.T_bukuBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub lihat_buku_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_buku' table.
You can move, or remove it, as needed.
Me.T_bukuTableAdapter.Fill(Me.PerpustakaanDataSet.t_buku)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Me.T_bukuTableAdapter.Fill(Me.PerpustakaanDataSet.t_buku)

End Sub

Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Dim dt = T_bukuTableAdapter.GetDataBy3cari_buku(TextBox1.Text)
If dt.Rows.Count = 0 Then
MsgBox("data tidak ditemukan", MsgBoxStyle.Critical, "information")
Else
Me.T_bukuTableAdapter.FillBycari_buku(Me.PerpustakaanDataSet.t_buku,
TextBox1.Text)

End If
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Me.Hide()
Beranda.Show()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Me.Hide()
Report_buku.Show()

End Sub
End Class

Koding di Input Anggota

Public Class input_anggota


Sub bersih()
NisTextBox.Text = ""
NamaTextBox.Text = ""
Tempat_lahirTextBox.Text = ""
Jenis_kelaminTextBox.Text = ""
JurusanTextBox.Text = ""

End Sub

Private Sub anggota_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_anggota'
table. You can move, or remove it, as needed.
Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_anggota'
table. You can move, or remove it, as needed.
'Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_anggota'
table. You can move, or remove it, as needed.
'Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)

End Sub

Private Sub T_anggotaBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs)
Me.Validate()
Me.T_anggotaBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub T_anggotaBindingNavigatorSaveItem_Click_1(ByVal sender As System.Object,


ByVal e As System.EventArgs)
Me.Validate()
Me.T_anggotaBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub T_anggotaBindingNavigatorSaveItem_Click_2(ByVal sender As System.Object,


ByVal e As System.EventArgs)
Me.Validate()
Me.T_anggotaBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Try
T_anggotaTableAdapter.simpan(NisTextBox.Text, NamaTextBox.Text,
Tempat_lahirTextBox.Text, Tgl_lahirDateTimePicker.Text, Jenis_kelaminTextBox.Text,
JurusanTextBox.Text)
Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)
MsgBox("Data berhasil disimpan")
Catch ex As Exception
MsgBox("Data tidak berhasil disimpan", MsgBoxStyle.Critical, "Information")
End Try
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Try
T_anggotaTableAdapter.edit(NisTextBox.Text, NamaTextBox.Text,
Tempat_lahirTextBox.Text, Tgl_lahirDateTimePicker.Text, Jenis_kelaminTextBox.Text,
JurusanTextBox.Text, NisTextBox.Text)
Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)
MsgBox("Data berhasil diedit")
Catch ex As Exception
MsgBox("Data tidak berhasil diedit", MsgBoxStyle.Critical, "Information")
End Try
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Try
T_anggotaTableAdapter.hapus(NisTextBox.Text)
Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)
MsgBox("Data berhasil dihapus")
Catch ex As Exception
MsgBox("Data tidak berhasil dihapus", MsgBoxStyle.Critical, "Information")
End Try
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button5.Click
Call bersih()

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button4.Click
Me.Hide()
Beranda.Show()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button6.Click
T_anggotaBindingSource.MovePrevious()

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button7.Click
T_anggotaBindingSource.MoveNext()
End Sub
End Class

Koding di Lihat Anggota

Public Class lihat_anggota

Private Sub T_anggotaBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs)
Me.Validate()
Me.T_anggotaBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub lihat_anggota_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_anggota'
table. You can move, or remove it, as needed.
Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)

End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Me.T_anggotaTableAdapter.Fill(Me.PerpustakaanDataSet.t_anggota)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Me.Hide()
Beranda.Show()

End Sub

Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Dim dt = T_anggotaTableAdapter.GetDataBy3cari_anggota(TextBox1.Text)
If dt.Rows.Count = 0 Then
MsgBox("Data Tidak ditemukan!", MsgBoxStyle.Critical, "Information")
Else
Me.T_anggotaTableAdapter.FillBycari_anggota(Me.PerpustakaanDataSet.t_anggota,
TextBox1.Text)

End If
End If
End Sub
End Class

Koding di Login

Imports System.Data.SqlClient
Public Class login
Public conn As SqlConnection
Public cmd As SqlCommand
Public str As String
Public dr As SqlDataReader

Sub koneksi()
str = "Data Source=SAIPULBAHRI\SQLSERVER;Initial Catalog=perpustakaan;Integrated
Security=True"
conn = New SqlConnection(str)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Call koneksi()
cmd = New SqlCommand("select * from t_login where Username = '" & TextBox1.Text
& "' and Password = '" & TextBox2.Text & "'", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
MsgBox("login gagal", MsgBoxStyle.Critical, "information")
TextBox1.Clear()
TextBox2.Clear()

Else

Beranda.panel1.Text = dr.Item("Username")
Beranda.panel2.Text = dr.Item("hak_akses")
Beranda.Label5.Text = dr.Item("Username")

If Beranda.panel2.Text = ("admin") Then


Me.Hide()
Beranda.Show()
MsgBox("Anda berhasil login sebagai admin")
Beranda.Text = "admin"

ElseIf Beranda.panel2.Text = ("user") Then


Me.Hide()
Beranda.Show()
MsgBox("Anda berhasil login sebagai user")
Beranda.Text = "user"
Beranda.InputBukuToolStripMenuItem.Enabled = False
Beranda.InputAnggotaToolStripMenuItem.Enabled = False
Beranda.UserToolStripMenuItem.Enabled = False

End If
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
End
End Sub

Private Sub T_loginBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs)
Me.Validate()
Me.T_loginBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_login' table.
You can move, or remove it, as needed.
Me.T_loginTableAdapter.Fill(Me.PerpustakaanDataSet.t_login)

End Sub
End Class
Koding di Input User

Public Class input_user


Sub bersih()
UsernameTextBox.Text = ""
PasswordTextBox.Text = ""
Hak_aksesTextBox.Text = ""

End Sub

Private Sub T_loginBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs)
Me.Validate()
Me.T_loginBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub input_user_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_login' table.
You can move, or remove it, as needed.
Me.T_loginTableAdapter.Fill(Me.PerpustakaanDataSet.t_login)

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Try
T_loginTableAdapter.simpan(UsernameTextBox.Text, PasswordTextBox.Text,
Hak_aksesTextBox.Text)
Me.T_loginTableAdapter.Fill(Me.PerpustakaanDataSet.t_login)
MsgBox("data berhasil disimpan")
Catch ex As Exception
MsgBox("data tidak tersimpan", MsgBoxStyle.Critical, "information")
End Try
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Try
T_loginTableAdapter.edit(UsernameTextBox.Text, PasswordTextBox.Text,
Hak_aksesTextBox.Text, UsernameTextBox.Text)
Me.T_loginTableAdapter.Fill(Me.PerpustakaanDataSet.t_login)
MsgBox("data berhasil diubah")
Catch ex As Exception
MsgBox("data tidak terubah", MsgBoxStyle.Critical, "information")
End Try
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Try
T_loginTableAdapter.hapus(UsernameTextBox.Text)
Me.T_loginTableAdapter.Fill(Me.PerpustakaanDataSet.t_login)
MsgBox("data berhasil dihapus")
Catch ex As Exception
MsgBox("data tidak terhapus", MsgBoxStyle.Critical, "information")
End Try
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button5.Click
Call bersih()

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button7.Click
T_loginBindingSource.MoveNext()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button6.Click
T_loginBindingSource.MovePrevious()
End Sub
End Class

Koding di Lihat User

Public Class lihat_user

Private Sub T_loginBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs)
Me.Validate()
Me.T_loginBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PerpustakaanDataSet)

End Sub

Private Sub lihat_user_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
'TODO: This line of code loads data into the 'PerpustakaanDataSet.t_login' table.
You can move, or remove it, as needed.
Me.T_loginTableAdapter.Fill(Me.PerpustakaanDataSet.t_login)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Me.T_loginTableAdapter.Fill(Me.PerpustakaanDataSet.t_login)

End Sub

Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Dim dt = T_loginTableAdapter.GetDataBy3cari_username(TextBox1.Text)
If dt.Rows.Count = 0 Then
MsgBox("data tidak ditemukan", MsgBoxStyle.Critical, "information")
Else
Me.T_loginTableAdapter.FillBycari_username(Me.PerpustakaanDataSet.t_login, TextBox1.Text)
End If
End If
End Sub
End Class

You might also like