VB 2010 (Professional)
I'm using an unbound DataGridView for data entry. The first column is the row number, and will automatically be set when data is first entered in a row.
To that end, I set the first column to ReadOnly. However, when tabbing from column to column, column 0 still gets focus (nothing can be typed in, though, which is right). What I would like is for the tabbing to skip over column 0 and go directly to column 1, ready for user input.
So I added code to the CellEnter event as such:
Private Sub DataGridView1_CellEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
If e.ColumnIndex = 0 Then
'DataGridView1.Rows(e.RowIndex).Cells(1).Selected = True 'Didn't Work
DataGridView1.CurrentCell = DataGridView1.Item(1, e.RowIndex) 'Didn't Work too
As you can see in the sample code, I tried two different methods, but neither works. Both throw the error:
Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.
So, how do I do what I want to do?