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;
}
}
cell[length]on the next row, which is out of bounds. Use two variables for index, one which you reset to 0 on every row.