DataGridView.RowEnter is before the current cell changes?

B

Brian Tkatch

DataGridView's RowEnter event has e.RowIndex as the current (new) row.
Yet CurrentCellAddress.Y is the old value.

This can be easily seen in a new form. Create a new windows
application, add a DataGridView, in the code add:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim table As New DataTable
table.Columns.Add()
table.Rows.Add(table.NewRow)
table.Rows.Add(table.NewRow)
DataGridView1.DataSource = table
End Sub

Private Sub DataGridView1_RowEnter(ByVal sender As Object, ByVal e
As System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.RowEnter
MsgBox("RowEnter: " & e.RowIndex.ToString & vbCrLf _
& "CurrentCellAddress: " &
sender.CurrentCellAddress.Y.ToString)
End Sub

B.
 

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