Anda di halaman 1dari 5

MENGHUBUNGKAN DATABASE DENGAN VISUAL BASIC 2010

Langkah-Langkah:
1. Buka aplikasi Microsoft Access lalu buat datasheet view dengan membuat item Nama, NIM,
Waktu, a, b, c, D, X1, dan X2. Lalu save table dan file MS. Access.

2. Buka aplikasi Visual Basic 2010 lalu buat 4 form. Form 1 untuk login member ataupun
admin, form 2 untuk login data admin, form 3 untuk menginput data member, form 4 untuk
input nilai variable dan mencari nilai X1 dan X2, dan form 5 untuk riwayat menginputan
pencarian nilai X1 dan X2 member.
Contoh Form :
 Form 1 :

 Form 2 :
 Form 3 :

 Form 4 :

 Form 5 :

3. Masukkan koding-koding yang berkaitan dengan project yang dibuat.


Form 1 :
Public Class Form1

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


System.EventArgs) Handles Button1.Click
Form2.Show()
Me.Hide()

End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Form3.Show()
Me.Hide()

End Sub
End Class

Form 2
Public Class Form2

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


System.EventArgs) Handles Button3.Click
Form1.Show()
Me.Hide()

End Sub

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


System.EventArgs) Handles Button1.Click
If TextBox1.Text = "Luthfia" And TextBox2.Text = "1245" Then
Form5.Show()
Me.Hide()
ElseIf TextBox1.Text = "LuthfiaOF" And TextBox2.Text = "1710" Then
Form5.Show()
Me.Hide()
ElseIf TextBox1.Text = "Fericha" And TextBox2.Text = "1999" Then
Form5.Show()
Me.Hide()

End If

End Sub

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


System.EventArgs) Handles Button2.Click
If TextBox1.Text = "Luthfia" And TextBox2.Text = "1245" Then
Form3.Show()
Me.Hide()
ElseIf TextBox1.Text = "LuthfiaOF" And TextBox2.Text = "1710" Then
Form3.Show()
Me.Hide()
ElseIf TextBox1.Text = "Fericha" And TextBox2.Text = "1999" Then
Form3.Show()
Me.Hide()

End If

End Sub
End Class

Form 3
Public Class Form3

Private Sub Rumus_abcBindingNavigatorSaveItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Rumus_abcBindingNavigatorSaveItem.Click
Me.Validate()
Me.Rumus_abcBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.IchaDataSet)

End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'IchaDataSet.rumus_abc' table.
You can move, or remove it, as needed.
Me.Rumus_abcTableAdapter.Fill(Me.IchaDataSet.rumus_abc)

End Sub

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


System.EventArgs) Handles Button1.Click
Form4.Show()

End Sub
End Class

Form 4
Public Class Form4
Dim a As Integer
Dim b As Integer
Dim c As Integer
Private Sub Rumus_abcBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Rumus_abcBindingNavigatorSaveItem.Click
Me.Validate()
Me.Rumus_abcBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.IchaDataSet)

End Sub

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


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

End Sub

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


System.EventArgs) Handles Button1.Click
a = ATextBox.Text
b = BTextBox.Text
c = CTextBox.Text
DTextBox.Text = (b * b) - (4 * a * c)
X1TextBox.Text = (-(b) + (Math.Sqrt((b * b) - (4 * a * c)))) / 2 * a
X2TextBox.Text = (-(b) - (Math.Sqrt((b * b) - (4 * a * c)))) / 2 * a
End Sub

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


System.EventArgs) Handles Button2.Click
Form1.Show()
Me.Hide()

End Sub
End Class

Form 5
Public Class Form5

Private Sub Rumus_abcBindingNavigatorSaveItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Rumus_abcBindingNavigatorSaveItem.Click
Me.Validate()
Me.Rumus_abcBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.IchaDataSet)
End Sub

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


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

End Sub

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


System.EventArgs) Handles Button1.Click
Me.Rumus_abcBindingSource.Filter = "NIM LIKE '" + NIMTextBox.Text + "%'"
End Sub

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


System.EventArgs) Handles Button2.Click
Form1.Show()
Me.Hide()

End Sub
End Class

Anda mungkin juga menyukai