Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C# DataGridView_RowsAdded event not firing

Posted on 2016-11-19
1
Medium Priority
?
103 Views
Last Modified: 2016-11-20
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 
                        break;
                    }
            }
}

Open in new window

0
Comment
Question by:Paulagier
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 2000 total points
ID: 41894578
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.
0

Featured Post

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question