foreach (int i in dataGridView1.CurrentRow.Index)//“int”不包含“GetEnumerator”的公共定義,因此 foreach 語句不能作用於“int”類型的變量
{
GlobalVariable.XiuZhengLunMingCheng = dataGridView1.Rows[i].Cells[1].Value.ToString();
GlobalVariable.XiuZhengLunZhiJing = dataGridView1.Rows[i].Cells[2].Value.ToString();
GlobalVariable.XiuZhengLunYuanJiaoBanJing1 = dataGridView1.Rows[i].Cells[3].Value.ToString();
GlobalVariable.XiuZhengLunYuanJiaoBanJing2 = dataGridView1.Rows[i].Cells[4].Value.ToString();
GlobalVariable.JuLi1 = dataGridView1.Rows[i].Cells[5].Value.ToString();
GlobalVariable.JuLi2 = dataGridView1.Rows[i].Cells[6].Value.ToString();
GlobalVariable.XiuZhengLunXiuZhengGaoDu = dataGridView1.Rows[i].Cells[7].Value.ToString();
//MessageBox.Show(Convert.ToString(GlobalVariable.m_GrindingWheelSelected));
}
foreach (int i in dataGridView1.CurrentRow.Index)
{
}
這三行去掉,中間保留
GlobalVariable.XiuZhengLunMingCheng = dataGridView1.Rows[i].Cells[1].Value.ToString();
->
GlobalVariable.XiuZhengLunMingCheng = dataGridView1.CurrentRow.Cells[1].Value.ToString();
別的類似