C# with DataGrids

Posted on 2007-10-01
Last Modified: 2013-11-26
What I have has a C# GUI App using a data grid to connect to a access database. I have add the check box to the datagrid and now what I'm trying to do is when the click submit I can loop through data grid and get the values that are check. The problems that I'm having is I can't figure out how to get just thoses values little lowe how to loop through the data grid.

Thank you for your help.

Question by:thomasbonham
    LVL 15

    Expert Comment

    loop through like:

    foreach(DataGridItem objRecord in MyDataGrid.Items){
    LVL 21

    Accepted Solution

               for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    if (dataGridView1.Rows[i].Cells[0].Value != null &&
                        dataGridView1.Rows[i].Cells[0].Value.ToString() == "True")
                        MessageBox.Show(i.ToString()+" Selected");

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video discusses moving either the default database or any database to a new volume.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now