I am creating a program for test management, which has a statistics function, which calculates the number of bugs fixed Is not fixed, or N / A test cases are all listed on a datagrid view, where the first column is for test cases, the second is for a result (the column I want to work with) And later for comment only. This is a little bit of my code, to show what I'm talking about
private int passed () // This method assumes how many tests The cases have passed {int pass = 0; If (/ * what condition should I put here? * /) {Pass ++; } Return pass; } // Is this the best way to display percentages in real time? Private Zero RefreshTech (Object Sender, EventErgus E) {Display2.Text = passed (). ToString (); } "Result" column cells each have a blanket-box whose objects are "fixed", "N / A" and "not fixed". Please, I would like to know how I can program the value of those cells and then how many bugs have been fixed, use them as a condition for this count.
You should get an answer by shuffling through all the rows in the gridview.
int countFixed = 0; Int countUnFixed = 0; For (int i = 0; i & lt; dgv.rowCount; i ++) {if ((string) dgv.Rows [i] .cel [1] .Value == "fixed") // column names Referring to cells from and not indexFix ++; Else if ((string) dgv.Rows [i] .cel [1]. Value == "is not fixed") countUnFixed ++; }
No comments:
Post a Comment