472,981 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Navigating within a dataset

I want to navigate to a specific record within a dataset.datatable. Some of my controls are bound to this datatable, and it would be nice to do something like

me.bindingcontext(MyDataset.MyDatatable).position= MyDataset.MyDatatable.FindByMyKeyFiel

But since the Position property is an integer, this obviously doesn't work. Instead Ive been looping through the entire table (i.e.

Me.BindingContext(MyDataset.MyDataTable).Position =
While Not Me.BindingContext(MyDataset.MyDataTable).Current(" MyKeyField") = keyvalu
Me.BindingContext(MyDataset.MyDataTable).Position = Me.BindingContext(MyDataset.MyDataTable).Position +
End Whil

). This just seems wrong to me. Is there a better way?
Nov 20 '05 #1
1 998
Hi PMCguire,

I find it a nice routine you have made. Do not forget that underdeck a
shorter method would almost always do the same as your routine.

You can make it look nicer by first making a currencymanager as this
cma as new directcast(bindingcontext(mydataset.mydatatabble)
,currencymanager)
cma.Position = 0
While Not cma.Current("MyKeyField") = keyvalue
cma.Position += 1
End While


However I see also no better alternative at the moment.

Cor
Nov 20 '05 #2

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

Similar topics

2
by: Hassan Cheraghali | last post by:
Dear Sir I biging in asp.net and i want desine a data entry form with single record at time. i need navigate records but i dont now. Plese help me , how can i do this. Thanks for your time. ...
1
by: Lerp | last post by:
Hi all, I have a dataset made up of 3 tables that is bound to a datalist. On the itemdataBound event I call a sub that grabs a value (an id value) from the current row being outputted, queries...
2
by: Daveyman | last post by:
Hi, I'm having a problem navigating to/from a subweb using forms authentication. The setup in IIS is as follows: TestSite +----SecureDir +----ReportsSubWeb In VS.Net 2003 this has been...
5
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is...
1
by: madhu | last post by:
Hello all, I am a bignner to vb.net I am not able to move the dataset and bind the textbox to dataset. My objective is 1) when the form loads it should display the first record. and the...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
0
by: Linda W. | last post by:
Hi, I would appreciate any insight into the following issue.. I have an asp.net application with crystal reports being displayed.. All works fine from my IDE & I am trying to move the app to a...
0
by: Ohad Weiss | last post by:
Hi all, I've once asked about that topic. but didn't get an answer. I have a dataset based on 4 tables, which have relation between them. The main table presented to the user on textboxes...
0
by: Ohad Weiss | last post by:
Hi I have a problem with two textboxes binded to a dataset, based on paren table, and table for the child records. I can navigate between the master records (and of course the child records...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.