DataGridView Column Data to Array
问题 Is it possible to transfer all data from a DataGridView column to string[] array ? Here is my code so far, unfortunately, it can't convert DataGridViewRow to int foreach (DataGridViewRow dgvrows in dgvDetail.Rows) { array[dgvrows] = dgvDetail.Rows[dgvrows].Cell[3].value.ToString().Trim; } 回答1: You can do it in various ways: Use a normal for -loop. The foreach is only syntactic sugar, the real work is always done with the good old for-loop. Use foreach and the DataGridViewRow.Index property to