PC Review


Reply
Thread Tools Rate Thread

Setting CurrencyManager Position After Adding a DataRow

 
 
=?Utf-8?B?RGF2ZVZC?=
Guest
Posts: n/a
 
      20th Apr 2005
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.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGF2ZVZC?=
Guest
Posts: n/a
 
      22nd Apr 2005
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.


"DaveVB" wrote:

> 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.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is DataRow[string] uses DataRow[int] and DataRow[int] much efficient than DataRow[string]? Ryan Liu Microsoft C# .NET 3 2nd Feb 2008 07:14 AM
C# insertion of a record with CurrencyManager AddNew() method during the insertion of a father table record (with CurrencyManager AddNew() too) polocar Microsoft C# .NET 0 27th Sep 2006 06:51 PM
Distinguish 2 situations when a DataRow in Detached state; Or why not make the data row intact after being added then removed from a dataRow collection? Ryan Liu Microsoft Dot NET 0 7th Jun 2006 03:04 PM
CurrencyManager Refresh After New DataRow =?Utf-8?B?QnJpYW4gUmljaGFyZHNvbg==?= Microsoft C# .NET 3 20th Apr 2006 12:36 PM
Adding datarow to datarow and datragrid DotNetJunkies User Microsoft VB .NET 1 15th Jul 2004 12:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:38 AM.