Setting CurrencyManager Position After Adding a DataRow

G

Guest

I am trying to manage databound controls on a form with a TreeView as the
RecordSelection Source. As long as I am navigating among rows that existed
when the form was openned, I can set the CurrencyManager position using the
following line of code:

Me.BindingContext(dataView).Position = dataView.Find(treeview.node.tag.id)
The treeview.node.tag is a strongly typed DataRow from the underlying table
of the dataView.

However, when I add a row to the table, either directly or through the
dataView I am unable to set the Position property...After executing the line
of code above, the Position/Current row remains unchanged.

If I use the CurrencyManager.AddNew method instead, the current row seems
to change to the newly inserted row automatically, but subsequent calls to
the line of code above to move to other rows do not work properly. It is as
if the CurrencyManager is out of sync with the underlying table.

Can anyone help with what is happening here and how to avoid this problem?
Any help will be greatly appreciated.
 
G

Guest

Never mind. I figured out the problem
For the benefit of anyone in the group experiencing similar problems, it
seems the CurrencyManager cannot handle rows where a control is bound to a
Null valued column. I had missed initializing the value of a boolean field
to False and the DBNull value was apparently causing the problem....all works
fine now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top