string[] column0Array = new string[dataGridView1.Rows.Count]; string[] column1Array = new string[dataGridView1.Rows.Count]; int i = 0; foreach (DataGridViewRow row in dataGridView1.Rows) { column0Array[i] = row.Cells[0].Value != null ? row.Cells[0].Value.ToString() : string.Empty; column1Array[i] = row.Cells[1].Value != null ? row.Cells[1].Value.ToString() : string.Empty; i++; }