H
hunar abubakir
Guest
i have this code in my project that i do it with a help in this web site, my code check the datagridviewcheckboxcolumn checked state after that it checks another cell of datagridview with these to checks it execute a method, all my code is inside a button click. this is my code
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?
Continue reading...[/I][/I][/I][/I]
Code:
private void 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"] as DataGridViewCheckBoxCell;
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);
}
}
}
}
method but at the second click it do the job. anyone can help me please?
Continue reading...[/I][/I][/I][/I]
Last edited by a moderator: