How do I do this in DataGridView?

  • Thread starter Thread starter B. Chernick
  • Start date Start date
B

B. Chernick

Here's the basic scenario. A WinForms application with a datagridview bound
to a ObjectDataSource (VB/Dot Net 2.0) Adding is permitted.

What I would like to do is this: When entering the add row, if I am not in
the first column, immediately switch to the first column.

---------------------

I've been trying variations on this but I keep getting an error: Operation
is not valid because it results in a reentrant call to the
SetCurrentCellAddressCore function.

What is this? (I have yet to find a clear explaination anywhere on the web.)

Private Sub dgvParts_RowEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvParts.RowEnter
If dgvParts.Rows(e.RowIndex).IsNewRow Then
dgvParts.CurrentCell = dgvParts.CurrentRow.Cells(0)
End If
End Sub
 
Back
Top