Scrolling using ADHOC Bar!

  • Thread starter Thread starter InBigTrouble
  • Start date Start date
I

InBigTrouble

I’ve used the following code to bind the data from an access database
to text boxes in Windows Form in VB.Net. Now I want to be able to
scroll through the records using a adhoc bar and be able to jump from
the first to the last record. this coding only displays the first
record. Can anyone please help me?

Private Sub frmmemberdetails_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.OpenConnection()
Me.BindToTextbox()
End Sub

Public Sub OpenConnection()

Dim strPath As String = "C:\db1.mdb"
Dim strConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath

Dim objOleDbConnection As New
OleDbConnection(strConnectionString)

objOleDbConnection.Open()

Me._AmarsConnection = objOleDbConnection

End Sub

Public Sub BindToTextbox()


Dim strQuery As String = "SELECT * FROM [MemberDetails];"

Dim objOleDbCommand As New OleDbCommand(strQuery,
_AmarsConnection)

Dim objOleDbDataAdapter As New
OleDbDataAdapter(objOleDbCommand)

Dim objDataTable As New DataTable()

Try

objOleDbDataAdapter.Fill(objDataTable)
Me.txtmemberid.DataBindings.Add(New Binding("Text",
objDataTable, "MemberID"))
Me.txtfirstname.DataBindings.Add(New Binding("Text",
objDataTable, "FirstName"))
Me.txtlastname.DataBindings.Add(New Binding("Text",
objDataTable, "LastName"))
Me.txthouseno.DataBindings.Add(New Binding("Text",
objDataTable, "HouseNumber/Name"))
Me.txtstreetname.DataBindings.Add(New Binding("Text",
objDataTable, "StreetName"))
Me.txtarea.DataBindings.Add(New Binding("Text",
objDataTable, "Town"))
'city combobox
Me.txtpostcode.DataBindings.Add(New Binding("Text",
objDataTable, "PostCode"))
Me.txtemail.DataBindings.Add(New Binding("Text",
objDataTable, "MemberE-mail"))
Me.txthomeno.DataBindings.Add(New Binding("Text",
objDataTable, "HomeTel"))
Me.txtmobile.DataBindings.Add(New Binding("Text",
objDataTable, "MobileNumber"))
Me.txtdob.DataBindings.Add(New Binding("Text",
objDataTable, "DateOfBirth"))
Me.txtdatejoined.DataBindings.Add(New Binding("Text",
objDataTable, "DateJoined"))
Me.txtkinname.DataBindings.Add(New Binding("Text",
objDataTable, "NextOfKin-Name"))
Me.txtkinno.DataBindings.Add(New Binding("Text",
objDataTable, "NextOfKin-Tel"))
Catch ex As Exception
Me.ComboBox1.Text = ex.Message.ToString()
Finally
Me.CloseConnection()
End Try

End Sub

Sub CloseConnection()
_AmarsConnection.Close()
End Sub
End Class
 
Hi,

Take a look at the currencymanager class
http://msdn.microsoft.com/library/d...stemwindowsformscurrencymanagerclasstopic.asp

Ken
----------------------
InBigTrouble said:
I’ve used the following code to bind the data from an access database
to text boxes in Windows Form in VB.Net. Now I want to be able to
scroll through the records using a adhoc bar and be able to jump from
the first to the last record. this coding only displays the first
record. Can anyone please help me?

Private Sub frmmemberdetails_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.OpenConnection()
Me.BindToTextbox()
End Sub

Public Sub OpenConnection()

Dim strPath As String = "C:\db1.mdb"
Dim strConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath

Dim objOleDbConnection As New
OleDbConnection(strConnectionString)

objOleDbConnection.Open()

Me._AmarsConnection = objOleDbConnection

End Sub

Public Sub BindToTextbox()


Dim strQuery As String = "SELECT * FROM [MemberDetails];"

Dim objOleDbCommand As New OleDbCommand(strQuery,
_AmarsConnection)

Dim objOleDbDataAdapter As New
OleDbDataAdapter(objOleDbCommand)

Dim objDataTable As New DataTable()

Try

objOleDbDataAdapter.Fill(objDataTable)
Me.txtmemberid.DataBindings.Add(New Binding("Text",
objDataTable, "MemberID"))
Me.txtfirstname.DataBindings.Add(New Binding("Text",
objDataTable, "FirstName"))
Me.txtlastname.DataBindings.Add(New Binding("Text",
objDataTable, "LastName"))
Me.txthouseno.DataBindings.Add(New Binding("Text",
objDataTable, "HouseNumber/Name"))
Me.txtstreetname.DataBindings.Add(New Binding("Text",
objDataTable, "StreetName"))
Me.txtarea.DataBindings.Add(New Binding("Text",
objDataTable, "Town"))
'city combobox
Me.txtpostcode.DataBindings.Add(New Binding("Text",
objDataTable, "PostCode"))
Me.txtemail.DataBindings.Add(New Binding("Text",
objDataTable, "MemberE-mail"))
Me.txthomeno.DataBindings.Add(New Binding("Text",
objDataTable, "HomeTel"))
Me.txtmobile.DataBindings.Add(New Binding("Text",
objDataTable, "MobileNumber"))
Me.txtdob.DataBindings.Add(New Binding("Text",
objDataTable, "DateOfBirth"))
Me.txtdatejoined.DataBindings.Add(New Binding("Text",
objDataTable, "DateJoined"))
Me.txtkinname.DataBindings.Add(New Binding("Text",
objDataTable, "NextOfKin-Name"))
Me.txtkinno.DataBindings.Add(New Binding("Text",
objDataTable, "NextOfKin-Tel"))
Catch ex As Exception
Me.ComboBox1.Text = ex.Message.ToString()
Finally
Me.CloseConnection()
End Try

End Sub

Sub CloseConnection()
_AmarsConnection.Close()
End Sub
End Class



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Back
Top