views:

440

answers:

1

Hi!

I'm using WinForms and a DataGridView. I've register an CellClick event for selecting/unselecting 1 item (project name). The problem is that with CTRL button hold down + Mouseclick this Event is not fired.

This is my EventHandler:

private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= dataGridView.Rows.Count ||
                e.ColumnIndex < 0 || e.ColumnIndex >= dataGridView.Columns.Count) return;

            if (dataGridView.Rows[e.RowIndex].Selected)
                this.selectedProject = dataGridView.Rows[e.RowIndex].DataBoundItem as GlobalProject;
            else this.selectedProject = null;

            OnChoose(new OnChooseProjectEventArgs(this.selectedProject != null));            
        }

Why is that? And what's the workaround, please

A: 

Maybe you unsubscribe to the cellclick event somewhere. Normally the cell click fires even with the CTRL key being held down (I just tried it in a sample proj).

Or maybe you have a global hook in your app (or another control in the form) that catches CTRL key down and handles it somewhere else.

tzup