Public
Class Form1
Dim karyawan As DataRow
Browse
Private
Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button5.Click
Try
OpenFileDialog1.Filter
= "Image Files (*.jpg,*.JPEG, *.bmp, *.gif, *.png)|*.jpg;*.JPEG; *.bmp;
*.gif; *.png"
OpenFileDialog1.ShowDialog()
Label14.Text =
OpenFileDialog1.FileName
'GroupBox1.s =
GroupBox1.Text.Length
If Label14.Text <>
"" Then
PictureBox1.Image =
Image.FromFile(Label14.Text)
End If
Catch ex As
Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Keluar
Private
Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button4.Click
Me.Close()
End Sub
Simpan
Private
Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim simpan As DataRow
simpan =
DKaryawanDataSet.Karyawan.NewRow
simpan(0) = TextBox1.Text
simpan(1) = TextBox2.Text
simpan(2) = TextBox3.Text
simpan(3) = TextBox4.Text
simpan(4) = DateTimePicker1.Text
If RadioButton1.Checked = True Then
simpan(5) = "Pria"
Else
simpan(5) = "Wanita"
End If
simpan(6) = ComboBox1.Text
simpan(7) = ComboBox2.Text
simpan(8) = ComboBox3.Text
simpan(9) = DateTimePicker2.Text
simpan(10) = TextBox5.Text
simpan(11) = TextBox7.Text
simpan(12) = Label14.Text
DKaryawanDataSet.Karyawan.Rows.Add(simpan)
KaryawanTableAdapter.Update(DKaryawanDataSet)
MsgBox("Data Berhasil
Tersimpan", vbInformation, "Sukses")
kosong()
End Sub
Sub kosong()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
DateTimePicker1.Text = ""
RadioButton1.Checked = False
RadioButton2.Checked = False
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
DateTimePicker2.Text = ""
TextBox5.Text = ""
TextBox7.Text = ""
PictureBox1.Image = Nothing
TextBox1.Focus()
End Sub
Private
Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'TODO:
This line of code loads data into the 'DKaryawanDataSet.Karyawan' table. You
can move, or remove it, as needed.
Me.KaryawanTableAdapter.Fill(Me.DKaryawanDataSet.Karyawan)
'TODO:
This line of code loads data into the 'DKaryawanDataSet.Karyawan' table. You
can move, or remove it, as needed.
Me.KaryawanTableAdapter.Fill(Me.DKaryawanDataSet.Karyawan)
End Sub
Kosongkan
Private
Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
kosong()
End Sub
Delete
Private
Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Dim hapus As String
If TextBox1.Text = "" Then
MsgBox("Anda Yakin Ingin
Menghapus Data Tersebut..?", vbCritical, "Perhatian")
Else
hapus =
MessageBox.Show("Apakah anda yakin akan menghapus data tersebut",
"Peringatan", MessageBoxButtons.YesNo)
If hapus = vbYes Then
karyawan.Delete()
KaryawanTableAdapter.Update(DKaryawanDataSet)
kosong()
End If
End If
End Sub
Search
Private
Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button6.Click
With DKaryawanDataSet.Karyawan
karyawan =
.Rows.Find(TextBox1.Text)
If karyawan Is Nothing Then
MsgBox("Data Yang Anda
Cari Tidak Ditemukan", vbCritical, "PERHATIAN")
TextBox2.Focus()
Else
Call tampilkan()
End If
End With
End Sub
Sub tampilkan()
With karyawan
TextBox2.Text = .Item(1)
TextBox3.Text = .Item(2)
TextBox4.Text = .Item(3)
TextBox5.Text = .Item(10)
DateTimePicker1.Text = .Item(4)
If karyawan(5) = "Pria"
Then
RadioButton1.Checked = True
Else
RadioButton2.Checked = True
End If
DateTimePicker2.Text = .Item(9)
TextBox7.Text = .Item(11)
ComboBox1.Text = .Item(6)
ComboBox2.Text = .Item(7)
ComboBox3.Text = .Item(8)
PictureBox1.Image =
Image.FromFile(.Item(12))
Label14.Text = .Item(12)
End With
End Sub
Edit
Private
Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button7.Click
karyawan.EndEdit()
karyawan(0) = TextBox1.Text
karyawan(1) = TextBox2.Text
karyawan(2) = TextBox3.Text
karyawan(3) = TextBox4.Text
karyawan(4) = DateTimePicker1.Text
If RadioButton1.Checked = True Then
karyawan(5) = "Pria"
Else
karyawan(5) = "Wanita"
End If
karyawan(6) = ComboBox1.Text
karyawan(7) = ComboBox2.Text
karyawan(8) = ComboBox3.Text
karyawan(9) = DateTimePicker2.Text
karyawan(10) = TextBox5.Text
karyawan(11) = TextBox7.Text
karyawan(12) = Label14.Text
KaryawanTableAdapter.Update(DKaryawanDataSet)
MsgBox("Data Kryawan Berhasil
DiUbah!!!", vbInformation, "UPDATE DATA")
Call kosong()
TextBox1.Focus()
End Sub
End
Class
Cetak
Private
Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
Dim report As New FrmReportJabatan
If ComboBox1.Text = "Nik"
Then
report.CrystalReportViewer1.SelectionFormula = "{Jabatan.Nik}"
& "=" & "'" & TextBox1.Text & "'"
ElseIf ComboBox1.Text =
"Nama" Then
report.CrystalReportViewer1.SelectionFormula = "{Jabatan.Nama}"
& "=" & "'" & TextBox1.Text & "'"
ElseIf ComboBox1.Text =
"Jabatan" Then
report.CrystalReportViewer1.SelectionFormula =
"{Jabatan.Jabatan}" & "=" & "'" &
TextBox1.Text & "'"
ElseIf ComboBox1.Text =
"Gaji_Pokok" Then
report.CrystalReportViewer1.SelectionFormula =
"{Jabatan.Gaji_Pokok}" & "=" & TextBox1.Text
End If
report.Show()
End Sub
Normal
Private
Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
OleDbDataAdapter1.SelectCommand.CommandText = "select * from
Jabatan"
DataSet21.Clear()
OleDbDataAdapter1.Fill(DataSet21)
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox1.Clear()
End Sub