Web Site Devloped By Abhishek Mishra
Tech. Help By Anand Mishra
Contact no. 9425355631

Powerd by Shree Guru Kripa Computer


vb.net_Code_Connectivity program


This is vb.net_Code_Connectivity Program.Please Create a MS Access Data Base and save it Proper Folder. Then Try It. There is "N" is Name textbox, "S" is age textbox, "C" is City textbox and "Add" is Address textbox

Public Class Form1
Dim CON As New OleDb.OleDbConnection
Dim DA As New OleDb.OleDbDataAdapter
Dim DSET As DataSet
Dim BM As BindingManagerBase
Dim CB As OleDb.OleDbCommandBuilder

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CON = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\CODE.mdb")
DA = New OleDb.OleDbDataAdapter("SELECT * from table1", CON)
DSET = New DataSet
DA.Fill(DSET, "TABLE1")
DataGridView1.DataSource = DSET
CB = New OleDb.OleDbCommandBuilder(DA)
DataGridView1.DataMember = "TABLE1"
BM = BindingContext(DSET, "TABLE1")
ABHI() ' This is Sub Rootin Program.

N.DataBindings.Add(New Binding("TEXT", DSET, "TABLE1.NAME"))
A.DataBindings.Add(New Binding("TEXT", DSET, "TABLE1.AGE"))
C.DataBindings.Add(New Binding("text", DSET, "table1.city"))
ADD.DataBindings.Add(New Binding("TEXT", DSET, "TABLE1.ADDRESS"))
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BM.Position = 0
ABHI()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BM.Position = BM.Position - 1
ABHI()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
BM.Position = BM.Position + 1
ABHI()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
BM.Position = BM.Count - 1
ABHI()
End Sub
Sub ABHI()
Label5.Text = BM.Position + 1
End Sub

Private Sub BTADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTADD.Click
N.Text = ""
'It's for a new intery A.Text = ""
C.Text = ""
ADD.Text = ""
BM.EndCurrentEdit()
BM.AddNew()
N.Select()
N.Enabled = True
A.Enabled = True
C.Enabled = True
ADD.Enabled = True
N.Select()
End Sub

End Class