2.Bikin Database baru...klik kanan di daabase terus new database
beri nama lalu ok
4.Isi nama colom tabel dan tipe datanya
5.Isi data pada tabel
jika sudah lalu save all
6.buka visual basic 2010 bikin windows form baru lalu tambahkan data source baru
Kemudian pilih Database kemudian klik next, pilih Dataset klik next kembali.
Klik Next pilih New
Connection
Pilih Microsoft SQL Server,
lalu Continue
Kemudian isikan User SQL Server Authentication lalu pilihlah Select or
enter a database name pilih nama database yang telah dibuat sebelumnya,
kemudian klik test conection bila sukses klik ok
kemudian klik next,
kemudian cetang pilihan sesuai kebutuhan kemudian klik finish.
8.Drag atau tarik colom yg berada di table tbmahasiswa dengan tabelnya ke from, ganti jurusan dengan combobox.ganti tgllahir dengan date time picker,ganti visible tbmahasiswaBindingSource menjadi false,tambah button awal sebelumnya selanjutnya akhir tambah cari hapus simpan keluar.
codingnya...
"Awal"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TbmahasiswaBindingSource.MoveFirst()
End Sub
"Sebelumnya"
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.TbmahasiswaBindingSource.MovePrevious()
End Sub
"Selanjutnya"
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.TbmahasiswaBindingSource.MoveNext()
End Sub
"Akhir"
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.TbmahasiswaBindingSource.MoveLast()
End Sub
"Tambah"
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.TbmahasiswaBindingSource.AddNew()
End Sub
"Simpan"
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Me.Validate()
Me.TbmahasiswaBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DbmahasiswaDataSet)
End Sub
"Hapus"
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Me.TbmahasiswaBindingSource.RemoveCurrent()
End Sub
"Cari"
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim cari As String
Dim posisi As Integer = 1
cari = InputBox("Masukkan Nama", "Cari Nama")
If (TbmahasiswaBindingSource.Find("Nama", cari)) > -1 Then
MsgBox("Data Ditemukan", vbOKOnly, "Pencarian Data")
Me.TbmahasiswaBindingSource.Position = TbmahasiswaBindingSource.Find("Nama", cari)
posisi = TbmahasiswaBindingSource.Find("Nama", cari) + 1
Else
MsgBox("Data Tidak Ditemukan", vbOKOnly, "Pencarian Data")
End If
End Sub
"Keluar"
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If (MsgBox("Anda yakin ingin keluar ?", vbQuestion + vbYesNo + vbDefaultButton2, "Keluar")) = vbYes Then
Me.Close()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TbmahasiswaBindingSource.MoveFirst()
End Sub
"Sebelumnya"
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.TbmahasiswaBindingSource.MovePrevious()
End Sub
"Selanjutnya"
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.TbmahasiswaBindingSource.MoveNext()
End Sub
"Akhir"
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.TbmahasiswaBindingSource.MoveLast()
End Sub
"Tambah"
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.TbmahasiswaBindingSource.AddNew()
End Sub
"Simpan"
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Me.Validate()
Me.TbmahasiswaBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DbmahasiswaDataSet)
End Sub
"Hapus"
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Me.TbmahasiswaBindingSource.RemoveCurrent()
End Sub
"Cari"
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim cari As String
Dim posisi As Integer = 1
cari = InputBox("Masukkan Nama", "Cari Nama")
If (TbmahasiswaBindingSource.Find("Nama", cari)) > -1 Then
MsgBox("Data Ditemukan", vbOKOnly, "Pencarian Data")
Me.TbmahasiswaBindingSource.Position = TbmahasiswaBindingSource.Find("Nama", cari)
posisi = TbmahasiswaBindingSource.Find("Nama", cari) + 1
Else
MsgBox("Data Tidak Ditemukan", vbOKOnly, "Pencarian Data")
End If
End Sub
"Keluar"
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If (MsgBox("Anda yakin ingin keluar ?", vbQuestion + vbYesNo + vbDefaultButton2, "Keluar")) = vbYes Then
Me.Close()
End If
End Sub
Tidak ada komentar:
Posting Komentar