I have a checkbox column, and it is working just as intended.
How do I "get" the selected rows ?
I'd like to get the ones that are checked and run a method using another field of the same row.
I believe the answer would look something like:
foreach (DataGridViewRow item in DataGridName.Rows)
{
if (((bool)(item.Cells["name_of_column"].Value)) == true)
{
MyMethod(item.Cells["name_od_the_other_field"].Value);
}
}
Solved it through:
foreach (DataGridViewRow item In DataGridName.Rows)
{
If (item.Cells(0).Value)
{
MyMethod(item.Cells(0).Value);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With