I have a checkbox column and it works as intended.
How do I βgetβ selected rows?
I would like to get the ones that were checked and run the method using a different field on the same line.
I solved it through:
foreach (DataGridViewRow item In DataGridName.Rows) { If (item.Cells(0).Value) { MyMethod(item.Cells(0).Value); } }
I believe the answer will look something like this:
foreach (DataGridViewRow item in DataGridName.Rows) { if (((bool)(item.Cells["name_of_column"].Value)) == true) { MyMethod(item.Cells["name_od_the_other_field"].Value); } }
Source: https://habr.com/ru/post/1310501/More articles:How can I simplify this redundant code? - variablesHow to get JDBC NUMERIC column value, which can be NULL, without any conversion cost? - javaVariable functions and variable names in PHP - variablesWhy does this quicksort work? - cError CrossDomain - silverlightSpring GAE / J Could Not Find API Version Error - javaIn iTextSharp, can I set the vertical position of a pdfwriter file? - c #Hello World to Twitter from C # - c #The function C is called only once and the cyclic complexity is ctwitter in C # 2010 - c #All Articles