privatevoid update_bt_Click(object sender,EventArgs e){var current_year =DateTime.Today.Year;var last_year =DateTime.Today.Year-1;for(int i =0; i < dgv_student_update.Rows.Count; i++){Func<DataGridViewRow,int,int> cellValue =(row, j)=>{int.TryParse(row.Cells["stg_id"].Value.ToString(),out j);return j;};DataGridViewCheckBoxCell chkchecking = dgv_student_update.Rows[i].Cells["result"]asDataGridViewCheckBoxCell;if(Convert.ToBoolean(chkchecking.Value)==true){//check if cell[3] in each row equal to stage id (1=first stage).if(cellValue(dgv_student_update.Rows[i],3)==1){
sc.year_student_update(Convert.ToInt32(dgv_student_update.Rows[i].Cells[1].Value),
dgv_student_update.Rows[i].Cells[2].Value.ToString(),2);}}}}
when i click button it does not execute the "year_student_update()"
method but at the second click it do the job. anyone can help me please?
|