471,111 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,111 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 943
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)
cma.Position = 0
While Not cma.Current("MyKeyField") = keyvalue
cma.Position += 1
End While

However I see also no better alternative at the moment.

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Hassan Cheraghali | last post: by
1 post views Thread by Lerp | last post: by
2 posts views Thread by Daveyman | last post: by
5 posts views Thread by Roy Lawson | last post: by
reply views Thread by Ohad Weiss | last post: by

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.