私のプロジェクトでこのコードを持っています。私はこのWebサイトのヘルプで行います。私のコードは、datagridviewcheckboxcolumnチェック状態をチェックした後、データグリービューの別のセルをチェックしてメソッドを実行するかどうかをチェックし、ボタンをクリックします。 私はそれが「year_student_update()」メソッドを実行しない]ボタンをクリックするが、第2に、それは仕事をクリックしたときに、これは私のコード私のコードは初めて実行されませんか?どうして?
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);
}
}
}
}
です。誰も私を助けることができますか?
Visual Studioを使用していますか? WPF? WinForms? ASPX? – GibralterTop
yes visual studio 2013. winforms –
ここで「sc」は定義されていますか? –