Pregunta

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).

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.

I have tried using the click event as per msdn, however this had no effect when i tested it: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.columnheadermouseclick.aspx

private void dataCapPlan_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
    {
        MessageBox.Show("OK");
    }

for DataGridView dataCapPlan

Any Ideas?

Much Appreciated!

Form

¿Fue útil?

Solución

Needed to add code:

dataCapPlan.ColumnHeaderMouseClick +=new DataGridViewCellMouseEventHandler(dataCapPlan_ColumnHeaderMouseClick);

see post: Event for clicking on row headers in DataGridView

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top