I don't know if this is your problem but from what I can see here you are
using the BindingContext to return a BindingManagerBase who's underlying
datasource is a DataTable.  You are then creating a view, sorting it and
finding the index of the DATAVIEWS row that has the selected AddressID.
This index may or may not be the same index that corresponds to the
DataTable's position for the row with the selected AddressID.  Try setting
the PrimaryKey property of the DataTable and use the DataTable.Rows.Find()
method to get the index for the bm.Position property.  Not sure if this
will help you though.

Chad

On Thu, 17 Jun 2004 09:52:03 -0400, Dennis Childers <[EMAIL PROTECTED]>
wrote:

>I am having great difficulty with some code I have used (found the basic
>idea on the internet).  Basically, I have a tree whose node tags contain a
>datarow.  When a node is selected, the following code uses a dataview to
>find the index of the row in the underlying datatable and then uses a
>bindingmanagerbase to change the current position in the datatable.  This
>code seems to work fine - in debug the position changes - but controls
that
>are bound to the underlying datatable do not change their values.
>
>The controls are bound in this way:
>
>Me.txtTester.DataBindings.Add("text", mDS.Tables
("Address"), "AddressLine1")
>
>
>
>Here is the code which does the position change:
>
>Dim bm As BindingManagerBase = BindingContext(mDS, "Address")
>
>Dim view As DataView = New DataView(mDS.Tables("Address"))
>view.Sort = "AddressID"
>
>Dim therow As DataRow = Me.trResidence.SelectedNodes(0).Tag
>Dim id As Integer = Integer.Parse(therow("AddressID").ToString)
>bm.Position = view.Find(id)
>
>
>
>Can someone help me fix this?
>
>DC
>
>===================================
>This list is hosted by DevelopMentorŪ  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to