//works out the grades by passing the progress 8 scores through DataAnalysis class (grade boundaries) public void gradeWorkout(StudentDataForm sdf) { //Adding the grade to the mock result from DatAnalysis DataAnalysis mock = new DataAnalysis(); #region progress 8 conversions ------------- //new progress 8 measures conversions. for (int i = 0; i <= dt.Rows.Count - 1; i++) { //takes the value from the table and passes through mock 1 (2015 exam boundaries). double prog8 = mock.progress8Mock1(Convert.ToInt32(dt.Rows[i][7])); //takes the value from the table and passes through mock 2 (2016 exam boundaries). double prog82 = mock.progress8Mock2(Convert.ToInt32(dt.Rows[i][9])); //this adds the result into the datagrid. //I need to stop this from rounding sdf.dgvStudentProgress.Rows[i].Cells[8].Value = prog8; sdf.dgvStudentProgress.Rows[i].Cells[10].Value = prog82; //Distance travelled displayed and worked out. double totalDist = mock.distanceTravelled(prog8, prog82); sdf.dgvStudentProgress.Rows[i].Cells[11].Value = (totalDist - (Convert.ToInt32(dt.Rows[i][6]))); } #endregion }