Q:

Problems while adding a new row in DataGridView on "MouseClick" event

I need to add a new row to DataGridView on "MouseClick" event. I do it, but the row is also added when I click on existing cells. I have another handlers on "CellClick/CellEndEdit" events and "MouseClick" is also raised in common with them. How to avoid this? Please help to solve this problem.
Thanks.
CellEndEdit event:
private void dataGridViewWorks_CellEndEdit(object sender, DataGridViewCellEventArgs e)
    {
        FormSelectItem frm = new FormSelectItem(formMain);
        switch (dataGridViewWorks.Columns[e.ColumnIndex].Name)
        {
            case "WorksWORKNAME":
                //some functions
                break;

            case "WorksCATNR":
                //some functions
                break;

            case "WorksQuantity":

                //some functions
                break;
            default:
                break;
        }
    }

MousClick event:
private void dataGridViewWorks_MouseClick(object sender, MouseEventArgs e)
    {
        if (dataGridViewWorks.Rows.Count == 0)
        {
            dataGridViewWorks.Rows.Add();
            return;
        }
        dataGridViewWorks.Rows.Insert(dataGridViewWorks.Rows.Count);
        dataGridViewWorks.CurrentCell = dataGridViewWorks.Rows[dataGridViewWorks.Rows.Count - 1].Cells[1];
    }

A:

Instead of dataGridViewWorks_MouseClick you can use dataGridViewWorks_MouseDoubleClick for adding the rows its an good idea :)

