473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

BindingSource_PositionChanged

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

Oct 17 '08 #1
2 2388
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.
Oct 17 '08 #2
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.
Oct 19 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: nmilne | last post by:
be soft this is my first post here I have a problem with the richtextbox.rtf code when I run my program And move to the next record then move back: (this is how the data looks before...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.