I am currently working in VB.net 2013 with windows forms. I have a code that will select a string by looking at columns but if the end user click the header of the checkbox column the program tries to select something it cant. My question is, is there an if statement that pretty much says, IF column header of row (x) is clicked exit sub? Here is my code, it is a databound DGV. My failsafe is actually getting me here.
 Private Sub DataGridCombined_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridCombined.CellContentClick
    'failsafe to make sure only the ordered column is being clicked
    If e.ColumnIndex <> 6 Then
        Exit Sub
    End If
    'dim L as the Job number string
    Dim L As String = DataGridCombined.Rows(e.RowIndex).Cells(2).Value
    'Bring up a messagebox to double check that the correct Job was selected
    Select Case MsgBox("Are you sure you want to order Job Number " & L & "?", MsgBoxStyle.YesNo)
        'if message box user end returns no
        Case MsgBoxResult.No
            Exit Sub
            'if message box user returns yes
        Case MsgBoxResult.Yes
            Try
                'sql code to update the FCOrdered table to form channel complete
                Using conn1 As New SqlConnection(connstring)
                    conn1.Open()
                    Using comm1 As SqlCommand = New SqlCommand("UPDATE Production.dbo.tblFCOrdered SET Ordered = 1 WHERE JobNumber = '" & L & "'", conn1)
                        comm1.ExecuteNonQuery()
                        conn1.Close()
                    End Using
                End Using
                'catch statement for try statement
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
    End Select
 
    