How do I do this in DataGridView?

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
 

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