473,804 Members | 3,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2276

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.Bindin gContext(datase t1.Tables("your tbl")), CurrencyManager )
cmgr.Position = 0 '--initialize position of currencymanager

'--then bind the textboxes - say you have 5 textboxes
Me.txt1.DataBin dings.Add("Text ", dataset1.Tables ("yourtbl"), "fld1")
Me.txt2.DataBin dings.Add("Text ", dataset1.Tables ("yourtbl"), "fld2")
Me.txt3.DataBin dings.Add("Text ", dataset1.Tables ("yourtbl"), "fld3")
Me.txt4.DataBin dings.Add("Text ", dataset1.Tables ("yourtbl"), "fld4")
Me.txt5.DataBin dings.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.DataBin dings.Add("Text ", dataset1.Tables ("yourtbl"), "fld1")

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

For each dc As DataColumn In dataset1.Tables ("yourtbl").Col umns
Console.Write(d c.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*********@di scussions.micro soft.com> schreef in bericht
news:82******** *************** ***********@mic rosoft.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
325
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 with the orders that will display the orders of the customer that the user enters on the textbox. With combobox or lisbox the binding is automatically defined, but with controls with simple bound I just can not figure it out a easy way to do it. ...
2
5055
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") and then filled a DataTable by doing: myDataSet.Tables; and the XML looks this way: .... <situation>
3
1979
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
1542
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 problem? PS: I don't need a code example showing me how to do it without drag 'n' drop because I already know how. I WANT to learn how to do it with drag 'n' drop.
15
1484
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? because MS Access has a field count limitation of 255 and my table would have 327 fields so I have no choice. I'm using two Data adapters that generate a single DS with a relationship
1
1262
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 there are 2 tables books and author and say I want to make an application that will allow to
2
17978
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 all this script does is create an xml output file. After the navigate, the function stops and is triggered again when webbrowser_DocumentCompleted fires and then the XML file is read by the
2
4757
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 adorecordset.movenext, adorecordset,movefirst...etc. Please help me out.
1
3511
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 language="javascript">
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10317
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.