By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,809 Members | 1,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,809 IT Pros & Developers. It's quick & easy.

Getting checked checkboxes inside datagridview

Markus
Expert 5K+
P: 6,050
I have a datagridview on one of my forms, and in the grid there are checkboxes on each row. The checkboxes are so the rows can be deleted. However, I am unable to find (I have googled) the way of finding the selected checkboxes.

Does anyone here know how?

Thankyou.
Nov 6 '08 #1
Share this Question
Share on Google+
1 Reply


Markus
Expert 5K+
P: 6,050
Worked it out.

Revised code:

Expand|Select|Wrap|Line Numbers
  1. private void deleteButton_Click(object sender, EventArgs e)
  2.         {
  3.             for (int i = 0; i < IPArray.Count; ++i)
  4.             {
  5.                 DataGridViewRow Row = dataGridView1.Rows[i];
  6.                 if ((bool)dataGridView1.Rows[i].Cells["Delete"].Value == true)
  7.                 {
  8.                     MessageBox.Show("You selected " + Row.Cells["IP"].Value + " to be deleted.");
  9.                 }
  10.             }
  11.         }
Nov 6 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.