データグリッドビューとグリッドビューを使用しているC#でアプリを開発しています最初の列にはチェックボックスが含まれており、チェックボックスがtrueかどうかを確認したいのですが、「オブジェクト参照がインスタンスに設定されていません」という例外が表示されますオブジェクト」。コードは次のとおりです
private void btnDelete_Click(object sender, EventArgs e)
{
StudentDAL s = new StudentDAL();
try
{
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
if (!DBNull.Value.Equals(this.dataGridView1.Rows[i].Cells[0]) && (bool)this.dataGridView1.Rows[i].Cells[0].Value == true)
{
s.delete(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value));
i--;
}
}
this.dataGridView1.DataSource = s.getAll();
}
catch (Exception nn)
{
}
}
私を助けてください。