`StringBuilder detail = new StringBuilder("");
string f10username;
string f10number;
public void button1_Click(object sender, EventArgs e)
{
if (a + b + c + d == 4)
{
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
f10username = this.dataGridView1.Rows[i].Cells[1].Value.ToString();
f10number = this.dataGridView1.Rows[i].Cells[9].Value.ToString();
detail.Append("圖書編號" + f10username + "有" + f10number + "本;\n");
}
Form11 f11 = new Form11(this.label2 .Text ,this .nameform10,this .textBox1 .Text ,this .textBox2 .Text ,this .textBox3.Text ,this .comboBox1 .Text ,this .datetime,this.detail .ToString (),this.label10 .Text );
f11 .ShowDialog ();
}
}``
這是我自己寫的,但是報錯,求大神指點
可以遍歷整個Datagridview的rows,然後獲取column["想要獲取的列的名稱"]的值