title: C#: Create click event for DataGridView column heading
body: <p>I am trying to create a click event for a DataGridView column headers so that when the user clicks to reorder the data I can run code to draw the gantt chart in the new order (see screen shot below).</p>
  
  <p>As you can see I want the user to be able to sort the datagridview and the gantt chart to respond to the re-ordering.</p>
  
  <p>I have tried using the click event as per msdn, however this had no effect when i tested it:
  <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.columnheadermouseclick.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.columnheadermouseclick.aspx</a></p>
  
  <pre><code>private void dataCapPlan_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
      {
          MessageBox.Show("OK");
      }
  </code></pre>
  
  <p>for DataGridView <code>dataCapPlan</code></p>
  
  <p>Any Ideas?</p>
  
  <p>Much Appreciated!</p>
  
  <p><img src="https://i.stack.imgur.com/d6zAN.png" alt="Form"></p>