binding source position when sorted

R

Rick

VS 2005

I want to make sure I have this concept down correctly.

I have a strongly typed datatable and a binding source connected to it.

On my windows form a grid is connected to the binding source.

When the grid is unsorted the datatable(bindingsource.positon).mycol =
DirectCast(bindingsource.current, datarowview).Item("mycol").

When I sort the grid the bindingsource.position is now out of synch with the
underlying datatable so the above are not equal.

I ask becuase I have to use a column value in a bindingsource positon
changed event and if the grid is sorted the value is no longer in synch.

Do I have this correct?

Rick
 
C

ClayB

Instead of datatable(bindingsource.positon), try using
datatable.DefaultView(bindingsource.positon). I think this should
match up with bindingsource.current even if the grid is sorted.

=========================
Clay Burch
Syncfusion, Inc.
 
R

Rick

Thanks, but that doesn't work.

With some sorts it is the same, but others no. I thought it was numeric vs
string sorts, but that didn't hold out.

I ended up by casting bindingsource.current as a datarowview and then get
the column value.

Rick
 
C

Cor Ligthert [MVP]

Still is the sort code placed in the
datasource.defaultview.sort propertie

Cor
 

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