Yeah I was just surprised because,
If I click on the datagridview to a new row,
the cursor is at the new row,
the bindingsource event hits first, but if you debug.writeline the
datagrid.currentrow.index, it is still at the old row.
All part of learning i guess -
Thanks
Miro
"Jack Jackson" <jj******@cinnovations.netwrote in message
news:7h********************************@4ax.com...
On Fri, 17 Oct 2008 16:05:32 -0400, "Miro" <mi**@beero.comwrote:
>>I don't seem to understand the timing of some events.
I have a datagridview bound to a binding source.
When I click on a different row within the datagridview, the
BindingSource_PositionChanged gets fired and also the
CurrentCellChanged gets fired.
My problem is that, when the BindingSource_PositionChanged fires, the
Me.DataGrid.CurrentRow.Index is still pointing to the old pointer.
For example I have 4 rows in the datagridview.
Row 1
Row 2 <- Cursor is here
Row 3 <-Cursor will be moved here
Row 4
When the cursor is moved, the Me.DataGrid.CurrentRow.Index still points to
row 2 and not 3.
Whats the point of using Me.DataGrid.CurrentRow.Index when it is not the
value it really is?
Miro
Since the BindingSource position and the DataGridView position are
separate things, I don't think you will be able to reliably get
correct information from one of them in the event handler for the
other.
You could use the changing event of the DataGridView and look at
CurrentRow in that, or the changing event of the BindingSource and its
Position value.