string s = ""; foreach (DataGridViewRow item in dataGridView1.Rows) { s += item.Cells["单词"].FormattedValue + " "; } MessageBox.Show(s);
为什么不用for呢 因foreach快
string s = ""; for (int i = 0; i < dataGridView1.Rows.Count; i++) { s += dataGridView1.Rows[i].Cells["单词"].FormattedValue + " "; } MessageBox.Show(s);