Refreshing bind info in controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a form with few labels and textboxes with databind to a certain dataset
I want to be able to search the dataset for a specific record and once I find it, refresh the information in my controls according to the current row

Currently, in my labels and textboxes, i see the first ro data all the time
is there a "refresh" cmmand or a referral command for the binding to the current row

Thanks
Ori
 
This involves using a currency manager, which you can get from doing

Dim cm as CurrencyManager

cm = me.BindingContext(myDataSource)

you can set the Position property to update all the bindings... by switching
the position, it will raise the ListChanged event which will notify your
bindings to refresh there values.

find only creates a reference to the found row, it does not move the
position. The other option to currency manager is to use a DataView. In
which case you can filter down to a single record of a dataset without
modifying the dataset data itself.

hth,

Ori :) said:
Hi !

I have a form with few labels and textboxes with databind to a certain dataset.
I want to be able to search the dataset for a specific record and once I
find it, refresh the information in my controls according to the current
row.
 
Thanks for your advice CJ, I implemented it in the following way

Dim CurrentPos As Integer =
Dim DRSite As DataRo
For Each DRSite In DsExpSite.Tables("SITE").Row
If DRSite("site_name") = "Chicago" Then Exit Fo
CurrentPos = CurrentPos +
Nex
Dim cm As CurrencyManage
cm = Me.BindingContext(DsExpSite, "SITE"
Me.BindingContext(DsExpSite, "SITE").Position = CurrentPo

It works great, is this the optimal solution for me ?
 
Back
Top