471,319 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Unexpected results from BindingSource.ResetCurrentItem()

Hi folks

Calling BindingSource.ResetCurrentItem() is changing the
BindingSource.Position in a way I don't understand.

If I'm understanding the docs correctly, ResetCurrentItem()
should simply trigger an event which causes controls to
refresh with the values of the current item with the index
BindingSource.Position. This is not what I'm seeing.

I'm trying to copy values from the current item to a new
item. In the code below, there are 400 items in the
underlying data (a strongly typed DataTable), and I'm trying
to copy the 100th item.
>>>>>>>>>>>>>>>>>>>>>>>>>> if( editAction == EditAction.Copy )
// bindingSource.Position == 99 as expected

DataRowView fromRow = (DataRowView)bindingSource.Current;

string label =


// bindingSource.Position == 400 as expected

DataRowView toRow = (DataRowView)bindingSource.Current;
toRow["label"] = label;

// Reset to update the control


// bindingSource.Position == 97, expected it to be 400

I don't understand why the Position is jumping to what seems
to be an arbitrary value.

I'm a C# newbie, so please forgive any basic errors. I'm at
a bit of a loss with this one, so any pointers would be much
Feb 21 '06 #1
0 4004

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by silesius | last post: by
6 posts views Thread by BD | last post: by
13 posts views Thread by bintom | last post: by
5 posts views Thread by jehugaleahsa | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.