When using a context menu on a datagridview right clicking doesn't select the record.
http://msdn.microsoft.com/smartclient/community/wffaq/wf20.aspx#al3sfum0
gives an answer that I have adapted below and you have to check that the user doesn't right click on the row header or column header (index -1 gives an error). Uses CellMouseDown event.
If e.ColumnIndex >= 0 And e.RowIndex >= 0 ThenMe.AppointmentsDataGridView.CurrentCell = Me.AppointmentsDataGridView.Rows(e.RowIndex).Cells(e.ColumnIndex)EndIf
Just wondering if there is a better way of doing this as it is sure to be a common problem.
GS
http://msdn.microsoft.com/smartclient/community/wffaq/wf20.aspx#al3sfum0
gives an answer that I have adapted below and you have to check that the user doesn't right click on the row header or column header (index -1 gives an error). Uses CellMouseDown event.
If e.ColumnIndex >= 0 And e.RowIndex >= 0 ThenMe.AppointmentsDataGridView.CurrentCell = Me.AppointmentsDataGridView.Rows(e.RowIndex).Cells(e.ColumnIndex)EndIf
Just wondering if there is a better way of doing this as it is sure to be a common problem.
GS