Guys, on form load i count my datagridview rows that only contain the status "UPREPD USED" and display the total on a label, it works fine.
My problem is i now want to count the rows that contain the status "UPREPD USED" and "UPREPD NEW" the code that works for the top line is below, i've tried putting ++ between the text quotations but doest work.
int count = 0; foreach (DataGridViewRow row in usedDataGridView.Rows)
{
if (row.IsNewRow) break;
object obj = row.Cells[2].Value;
if (obj != null && !DBNull.Value.Equals(obj) && obj.ToString() == "UNPREPD USED") count++;
{
label6.Text = count.ToString();
}
}
As mentioned the above works but only to count one status.

1 answers
Just add to the condition a check for "UNPREPD NEW".
[edit]
oops on varnames.
answered one year ago by:
538
690
Great reply - works a treat. Thanks.