1
Reply

Event Handler for DataGridView Rows

Barry Tipton

Barry Tipton

Feb 21 2006 3:15 PM
4.4k
I am using a DataGridView control in a Windows form. I have data bound to the view from a structure. I am trying to populate other fields in the form with data in the DataGridView. I use a dataGridView1_RowEnter event handler to extract the data from the CurrentRow. The problem is when I enter a row (by using a down arrow, mouse, etc.) the data extracted from the  dataGridView1.CurrentRow.Cells[x].Value.ToString() is from the row I just left rather than the  current row that is highlighted with the down arrow or mouse. It appears to move the cursor to the next row, run the code in the handler, and then set the focus on the row (place the right arrow > in the row header). I am looking for an event that fires just after the RowEnter handler to place the code. Any suggestions?

Answers (1)