以下代码给了我这个错误:https ://prnt.sc/q4truq
private void Form1_Load(object sender, EventArgs e)
{
MyDataGridView.Columns.Insert(0, new DataGridViewCheckBoxColumn());
MyDataGridView.Rows.Add(4);
MyDataGridView.Rows[0].Cells[0].Value = true;
MyDataGridView.Rows[1].Cells[0].Value = false;
MyDataGridView.Rows[2].Cells[0].Value = true;
MyDataGridView.Rows[3].Cells[0].Value = false;
MyDataGridView.Rows[4].Cells[0].Value = true;
string strResults = (MyDataGridView.Rows.Cast<DataGridViewRow>()
.Where(c => Convert.ToBoolean(r.Cells[0].Value).Equals(true))
.Count(s => Convert.ToInt32(t.Cells[0].Value))).ToString();
}