Public Class menu
Private Sub KoleksiFilmToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KoleksiFilmToolStripMenuItem.Click
frmFilm.Show()
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub PeminjamanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PeminjamanToolStripMenuItem.Click
frmPinjaman.Show()
End Sub
Private Sub AnggotaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnggotaToolStripMenuItem.Click
frmAnggota.Show()
End Sub
Private Sub lbNama_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbNama.Click
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
lbNama.Text = Microsoft.VisualBasic.Right(lbNama.Text, 1) + Microsoft.VisualBasic.Left(lbNama.Text, Len(lbNama.Text) - 1)
End Sub
End Class
samsul.maarifAl-ishlah
http.www.samsul.maarifAl-ishlah.com
Kamis, 24 November 2011
VB.NET 2008
Public Class frmFilm
Dim SQL As String
Dim proses As New clsKoneksi
Dim TblFilm As DataTable
Sub Data_Record()
TblFilm = Proses.ExecuteQuery(" Select * From (film) order by Judul asc ")
DgFilm.DataSource = TblFilm
End Sub
Private Sub frmFilm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
CboGenre.Items.Add("Drama")
CboGenre.Items.Add("Action")
CboGenre.Items.Add("Horor")
CboGenre.Items.Add("Komedi")
CboGenre.Items.Add("Thriller")
CboGenre.Items.Add("Dokumenter")
CboGenre.Items.Add("Animasi")
CboFormat.Items.Add("VHS")
CboFormat.Items.Add("vCD")
CboFormat.Items.Add("Blue Ray")
Call NonAktif()
End Sub
Sub Bersih()
TxtKode.Text = ""
TxtJudul.Text = ""
TxtStudio.Text = ""
CboFormat.Text = ""
CboGenre.Text = ""
TxtKode.Enabled = True
Call Data_Record()
btnSimpan.Enabled = False
btnUpdate.Enabled = False
btnHapus.Enabled = False
btnHapus.Enabled = False
btnBatal.Enabled = False
btnKeluar.Enabled = True
End Sub
Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
SQL = "Delete From [film]Where IDfilm ='" & TxtKode.Text & "'"
proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data telah dihapus..!!", "Penghapusan Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call Bersih()
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
Call Bersih()
Call NonAktif()
End Sub
Sub Aktif()
TxtJudul.Enabled = True
TxtArtis.Enabled = True
TxtStudio.Enabled = True
txtTahun.Enabled = True
CboGenre.Enabled = True
CboFormat.Enabled = True
End Sub
Sub NonAktif()
TxtJudul.Enabled = False
TxtArtis.Enabled = False
TxtStudio.Enabled = False
txtTahun.Enabled = False
CboGenre.Enabled = False
CboFormat.Enabled = False
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
SQL = "Update [film] Set Judul = '" & TxtJudul.Text & "', Artis='" & TxtArtis.Text & "', Genre = '" & CboGenre.Text & "', Format = '" & CboFormat.Text & "', Studio = '" & TxtStudio.Text & "', Tahun = '" & txtTahun.Text & "' where IDFilm = '" & TxtKode.Text & "'"
proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data telah diubah..!!", "Perubahan Data Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call Bersih()
Call NonAktif()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Me.Close()
End Sub
Private Sub frmFilm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Bersih()
End Sub
Private Sub DgFilm_DoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgFilm.DoubleClick
TxtKode.Text = DgFilm.SelectedCells(0).Value
btnSimpan.Enabled = False : btnUpdate.Enabled = True : btnHapus.Enabled = True
btnBatal.Enabled = True : btnKeluar.Enabled = False
End Sub
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
SQL = "Insert Into [film] Values ('" & TxtKode.Text & "','" & TxtJudul.Text & "','" & TxtArtis.Text & "','" & CboGenre.Text & "','" & CboFormat.Text & "','" & TxtStudio.Text & "','" & txtTahun.Text & "')"
proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data Baru telah disimpan..!!", "Penyimpanan Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call Bersih()
End Sub
Private Sub TxtKode_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtKode.TextChanged
If Len(TxtKode.Text) < 6 Then Exit Sub
TblFilm = proses.ExecuteQuery("Select * From [film] Where IDFilm='" & TxtKode.Text & "'")
If TblFilm.Rows.Count > 0 Then
'MessageBox.Show("Data Karyawan Tidak Ditemukan..!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information)
With TblFilm.Rows(0)
TxtKode.Text = .Item("IDFilm")
TxtJudul.Text = .Item("Judul")
TxtArtis.Text = .Item("Artis")
CboGenre.Text = .Item("Genre")
CboFormat.Text = .Item("Format")
TxtStudio.Text = .Item("Studio")
txtTahun.Text = .Item("Tahun")
End With
Call Aktif()
TxtKode.Enabled = False
TxtJudul.Focus()
btnSimpan.Enabled = False : btnKeluar.Enabled = True
btnUpdate.Enabled = True : btnHapus.Enabled = True : btnBatal.Enabled = True
Else
Call Aktif()
TxtKode.Enabled = False
TxtJudul.Focus()
btnSimpan.Enabled = True
btnUpdate.Enabled = False : btnHapus.Enabled = False : btnBatal.Enabled = True
End If
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub TxtJudul_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtJudul.TextChanged
End Sub
Private Sub DgFilm_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgFilm.CellContentClick
End Sub
End Class
Dim SQL As String
Dim proses As New clsKoneksi
Dim TblFilm As DataTable
Sub Data_Record()
TblFilm = Proses.ExecuteQuery(" Select * From (film) order by Judul asc ")
DgFilm.DataSource = TblFilm
End Sub
Private Sub frmFilm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
CboGenre.Items.Add("Drama")
CboGenre.Items.Add("Action")
CboGenre.Items.Add("Horor")
CboGenre.Items.Add("Komedi")
CboGenre.Items.Add("Thriller")
CboGenre.Items.Add("Dokumenter")
CboGenre.Items.Add("Animasi")
CboFormat.Items.Add("VHS")
CboFormat.Items.Add("vCD")
CboFormat.Items.Add("Blue Ray")
Call NonAktif()
End Sub
Sub Bersih()
TxtKode.Text = ""
TxtJudul.Text = ""
TxtStudio.Text = ""
CboFormat.Text = ""
CboGenre.Text = ""
TxtKode.Enabled = True
Call Data_Record()
btnSimpan.Enabled = False
btnUpdate.Enabled = False
btnHapus.Enabled = False
btnHapus.Enabled = False
btnBatal.Enabled = False
btnKeluar.Enabled = True
End Sub
Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
SQL = "Delete From [film]Where IDfilm ='" & TxtKode.Text & "'"
proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data telah dihapus..!!", "Penghapusan Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call Bersih()
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
Call Bersih()
Call NonAktif()
End Sub
Sub Aktif()
TxtJudul.Enabled = True
TxtArtis.Enabled = True
TxtStudio.Enabled = True
txtTahun.Enabled = True
CboGenre.Enabled = True
CboFormat.Enabled = True
End Sub
Sub NonAktif()
TxtJudul.Enabled = False
TxtArtis.Enabled = False
TxtStudio.Enabled = False
txtTahun.Enabled = False
CboGenre.Enabled = False
CboFormat.Enabled = False
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
SQL = "Update [film] Set Judul = '" & TxtJudul.Text & "', Artis='" & TxtArtis.Text & "', Genre = '" & CboGenre.Text & "', Format = '" & CboFormat.Text & "', Studio = '" & TxtStudio.Text & "', Tahun = '" & txtTahun.Text & "' where IDFilm = '" & TxtKode.Text & "'"
proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data telah diubah..!!", "Perubahan Data Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call Bersih()
Call NonAktif()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Me.Close()
End Sub
Private Sub frmFilm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Bersih()
End Sub
Private Sub DgFilm_DoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgFilm.DoubleClick
TxtKode.Text = DgFilm.SelectedCells(0).Value
btnSimpan.Enabled = False : btnUpdate.Enabled = True : btnHapus.Enabled = True
btnBatal.Enabled = True : btnKeluar.Enabled = False
End Sub
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
SQL = "Insert Into [film] Values ('" & TxtKode.Text & "','" & TxtJudul.Text & "','" & TxtArtis.Text & "','" & CboGenre.Text & "','" & CboFormat.Text & "','" & TxtStudio.Text & "','" & txtTahun.Text & "')"
proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data Baru telah disimpan..!!", "Penyimpanan Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call Bersih()
End Sub
Private Sub TxtKode_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtKode.TextChanged
If Len(TxtKode.Text) < 6 Then Exit Sub
TblFilm = proses.ExecuteQuery("Select * From [film] Where IDFilm='" & TxtKode.Text & "'")
If TblFilm.Rows.Count > 0 Then
'MessageBox.Show("Data Karyawan Tidak Ditemukan..!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information)
With TblFilm.Rows(0)
TxtKode.Text = .Item("IDFilm")
TxtJudul.Text = .Item("Judul")
TxtArtis.Text = .Item("Artis")
CboGenre.Text = .Item("Genre")
CboFormat.Text = .Item("Format")
TxtStudio.Text = .Item("Studio")
txtTahun.Text = .Item("Tahun")
End With
Call Aktif()
TxtKode.Enabled = False
TxtJudul.Focus()
btnSimpan.Enabled = False : btnKeluar.Enabled = True
btnUpdate.Enabled = True : btnHapus.Enabled = True : btnBatal.Enabled = True
Else
Call Aktif()
TxtKode.Enabled = False
TxtJudul.Focus()
btnSimpan.Enabled = True
btnUpdate.Enabled = False : btnHapus.Enabled = False : btnBatal.Enabled = True
End If
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub TxtJudul_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtJudul.TextChanged
End Sub
Private Sub DgFilm_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgFilm.CellContentClick
End Sub
End Class
Langganan:
Postingan (Atom)