DataGridView's RowEnter event has e.RowIndex as the current (new) row.
Yet CurrentCellAddr ess.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(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim table As New DataTable
table.Columns.A dd()
table.Rows.Add( table.NewRow)
table.Rows.Add( table.NewRow)
DataGridView1.D ataSource = table
End Sub
Private Sub DataGridView1_R owEnter(ByVal sender As Object, ByVal e
As System.Windows. Forms.DataGridV iewCellEventArg s) Handles
DataGridView1.R owEnter
MsgBox("RowEnte r: " & e.RowIndex.ToSt ring & vbCrLf _
& "CurrentCellAdd ress: " &
sender.CurrentC ellAddress.Y.To String)
End Sub
B.
Yet CurrentCellAddr ess.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(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim table As New DataTable
table.Columns.A dd()
table.Rows.Add( table.NewRow)
table.Rows.Add( table.NewRow)
DataGridView1.D ataSource = table
End Sub
Private Sub DataGridView1_R owEnter(ByVal sender As Object, ByVal e
As System.Windows. Forms.DataGridV iewCellEventArg s) Handles
DataGridView1.R owEnter
MsgBox("RowEnte r: " & e.RowIndex.ToSt ring & vbCrLf _
& "CurrentCellAdd ress: " &
sender.CurrentC ellAddress.Y.To String)
End Sub
B.