473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Navigate through a dataset

i have a dataset and want to step thrpugh each row each time a user clicks a
button,
Jun 27 '06 #1
4 2238

Peter Newman napisal(a):
i have a dataset and want to step thrpugh each row each time a user clicks a
button,


and do what?

For each row as new datarow in dataset1.tables(x).rows

next

Jun 27 '06 #2

basicly im displaying the data in text boxes, and need to allow the
operators to navigate thro the records
"Mrozu" wrote:

Peter Newman napisal(a):
i have a dataset and want to step thrpugh each row each time a user clicks a
button,


and do what?

For each row as new datarow in dataset1.tables(x).rows

next

Jun 27 '06 #3
You can use a CurrencyManager object and Databinding for navigating and
connecting the data to the textboxes. Here is how you do it:

Dim cmgr as currencyManager '--form level

Private Sub Form_Load(...)
....
cmgr = CType(Me.BindingContext(dataset1.Tables("yourtbl") ), CurrencyManager)
cmgr.Position = 0 '--initialize position of currencymanager

'--then bind the textboxes - say you have 5 textboxes
Me.txt1.DataBindings.Add("Text", dataset1.Tables("yourtbl"), "fld1")
Me.txt2.DataBindings.Add("Text", dataset1.Tables("yourtbl"), "fld2")
Me.txt3.DataBindings.Add("Text", dataset1.Tables("yourtbl"), "fld3")
Me.txt4.DataBindings.Add("Text", dataset1.Tables("yourtbl"), "fld4")
Me.txt5.DataBindings.Add("Text", dataset1.Tables("yourtbl"), "fld5")
....
End Sub

Then you can have a button where you increment the currencymanager like this:

Private Sub btn1_Click(...)
cmgr += 1 '--navigate forward
End Sub

Private Sub btn2_Click(...)
cmgr -= 1 '--navigate backward
End Sub

You bind the data from the dataset table to the textboxes. Just make sure
that dataset1.Tables("yourtbl") contains the fields that you specify in the
databinding

'----------------------------------------------------------------field/column name here
Me.txt1.DataBindings.Add("Text", dataset1.Tables("yourtbl"), "fld1")

If the binding isn't working, you can loop through all the columns in your
datatable (dataset1.Tables("yourtbl") ) like this:

For each dc As DataColumn In dataset1.Tables("yourtbl").Columns
Console.Write(dc.ColumnName & ", ")
Next

Look at the output window to see what columns (fields) your datatable
contains. These are the names you have to use in the Databinding of the
textboxes.

HTH
Rich
"Peter Newman" wrote:

basicly im displaying the data in text boxes, and need to allow the
operators to navigate thro the records
"Mrozu" wrote:

Peter Newman napisal(a):
i have a dataset and want to step thrpugh each row each time a user clicks a
button,


and do what?

For each row as new datarow in dataset1.tables(x).rows

next

Jun 27 '06 #4
Peter,

Have a look at that currencymanager.position in this sample. You can set
that to any value as long as it is inside the range 0 and table.row.count -
1

http://www.vb-tips.com/default.aspx?...f-587f730fa118

I hope this helps,

Cor

"Peter Newman" <Pe*********@discussions.microsoft.com> schreef in bericht
news:82**********************************@microsof t.com...

basicly im displaying the data in text boxes, and need to allow the
operators to navigate thro the records
"Mrozu" wrote:

Peter Newman napisal(a):
> i have a dataset and want to step thrpugh each row each time a user
> clicks a
> button,


and do what?

For each row as new datarow in dataset1.tables(x).rows

next

Jun 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mjpiedade | last post by:
I just started with C#. How do I navigate on a dataset by changing the value of a textbox or other simple bound controls? Imagine that I have the customer name on a textbox and have a datagrid...
2
by: Carl Lindmark | last post by:
Hello, I am having trouble understanding how to navigate a DataSet table... - maybe someone can steer me in the right direction? Say you've read an XML document into a DataSet ("myDataSet")...
3
by: ruca | last post by:
Hi Can I pass a DataSet from one page (parent) to another (child, popup window)? How can I do that? -- Programming ASP.NET with VB.NET
0
by: Oberon | last post by:
How do I navigate through records using drag 'n' drop controls? I have an example in C# for Windows forms that relies on BindingContext but this is not available for ASP.NET. How do I solve that...
15
by: Bob | last post by:
Hello: I'm building a simple windows database application that has two tables with One to One relationships on MS Access tables. I know what your thinking. Why not just use one table? ...
1
by: alps | last post by:
Hello friends , I am basically a delphi developer and am new to the VB.net technology.Can anyone out there give me a typical VB.net solution for a dataentry program for a table.Lets say...
2
by: Ryan Ramsey | last post by:
I have been chasing this one down for a week and have narrowed it down to a machine issue. I have the following code: webBrowser.Navigate(http://finao.net/post_dkp.php?database=40); Basically...
2
by: =?Utf-8?B?QmVybmFyZCBLaW0=?= | last post by:
I have VC# 2005. I need to use ADODB instead with ADO.NET. I can open a recordset. however, I can not navigate records in recordset. How can I navigate records? What is the command line for...
1
by: Falcula | last post by:
Hello, I have a treeview control, when i select a item i navigate to url. But selected node is lost, it reset itself, loosing state. I post my code here. Thanks in advance. <script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.