I have a DataGridView in which the User is presented with a TabControl containing two TabPages. The first TabPage contains a DataGridView control which lists "Detail" records. The second TabPage contains various controls in which to edit the row of data selected from the DGV.
In order for a User to edit a row of data, they need to double-click on a specific row...when they do that, the row of data is selected and the program will populate the controls on the second TabPage and the second TabPage will then have focus.
The problem that I am having is that if the User happens to double-click on a Column Header and not a specific row of data, the DataGridView_DoubleClick event fires and makes the second TabPage have the focus...which is what the DoubleClick event is suppose to do but not when a Column Header is double-clicked on.
I thought that if a Column Header was double-clicked, the DataGridView1_ColumnHeaderMouseDoubleClick() Event would fire but it doesn't appear to be as I have set a breakpoint in that event. What's the best way to handle a Double-Click on the Column Header? I have my code below.
Private Sub dgvEquipment_ColumnHeaderMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgvEquipment.ColumnHeaderMouseDoubleClick
blnColHeaderWasClicked = True
Private Sub dgvEquipment_DoubleClick(sender As Object, e As EventArgs) Handles dgvEquipment.DoubleClick
Dim row As DataGridViewRow = dgvEquipment.CurrentRow
If blnColHeaderWasClicked Then
blnColHeaderWasClicked = False
Catch ex As Exception
strErr = gfrmID & "/dgvEquipment_DoubleClick() - " & ex.Message
MessageBox.Show(strErr, "User Notification", MessageBoxButtons.OK, MessageBoxIcon.Error)