hi guys im new here =)
i would need your help in a minimal troubble case, to save time for me =)
The problem is about that, i want to have datagridview Cells Values and
save the values to an array.
Up to now it works fine, but it just reads the first row cell and after
that process it just tells that the index is out of bound, but i dont understand why.
foreach (DataGridViewRow row in dataGridView1.Rows) //wo soll er sich aufhalten -> zeilen
{
**if (row.Cells[i].Value == null)**
{
MessageBox.Show("This row is empty");
break;
}
if (row.Cells[i].Value != null)
{
UnsortArray[i] = row.Cells[i].Value.ToString();
MessageBox.Show(UnsortArray[i]);
++i;
}
}
also, I don’t understand why would you want to do messageBox.show inside a loop. It should be out side the loop.