?
Solved

C# with DataGrids

Posted on 2007-10-01
2
Medium Priority
?
177 Views
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.

Thomas
0
Comment
Question by:thomasbonham
2 Comments
 
LVL 15

Expert Comment

by:dave4dl
ID: 19992935
loop through like:

foreach(DataGridItem objRecord in MyDataGrid.Items){
     doSomethingWithThis(objRecord.Cells[0].Controls["MyCheckbox"].value);
}
0
 
LVL 21

Accepted Solution

by:
surajguptha earned 2000 total points
ID: 19992974
           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");
                }
            }
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

809 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