468,765 Members | 1,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

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 909
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 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
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.