• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • Last Modified:

C# DataGridView_RowsAdded event not firing

In a Windows Form I have a datagridview with a bindingsource.
The binding source connects to an external device that adds rows data each 1/20 sec.
Changes of the data are well displayed on the screen (within the datagridview)  but the DataGridView_RowsAdded in the code behind does not fire .
I am unable to understand why.
public void dgvvNodes_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
            string searchValueLA = "LeftArm";
            int rowIndexLA = -1;
            Node nodeLA;

            foreach (DataGridViewRow row in dgvvNodes.Rows)
                    if (dgvvNodes.Rows[e.RowIndex].Cells[5].ToString().Equals(searchValueLA)) // "position" is at index 5 in the last added row
                        rowIndexLA = row.Index;
                        nodeLA = dgvvNodes.Rows[e.RowIndex].DataBoundItem as Node; // get the object origin of data in the last added row 

Open in new window

1 Solution
Robberbaron (robr)Commented:
I believe the rows_added event is only fired when u manually add a row. via the gridview...

the DataBound is the only event that will be able to tell when rows are added by keeping a count of previous rows.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now