John Beeman

John Beeman

  • NA
  • 15
  • 0

Datagrid event handler problem?

Aug 20 2008 4:29 PM
Is there an event handler for datagrid that will only be called when user MANUALLY clicks in cell and changes a value? I have toyed with the code below. I am having trouble with this though because I also have the program setup to add groups of rows (anywhere from 1 to 50+ at a time) onto the datagrid when the user performs an action. Currently, the function is called ONCE whenever a group of rows are added. The code below, however, will unnecessarily trigger this event handler for EACH and EVERY row that gets added. Because the function is rather lengthy, this is really inefficient when large groups of rows get added.

I am looking for an event handler that will do either of the following. Either be called ONLY after an entire group of rows have been added. OR be called ONLY when the user manually clicks inside the datagrid and changes a value.

Can anyone assist with this?

private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            //Call function to go through entire datagrid and calculate/highlight rows
        }

Thanks,
John

Answers (1)