So I have a datagridview and it has a column called status. It has 3 values: New, Printed, and Shipped.
Now a user can select multiple rows and click "set to printed". I then do a foreach loop on datagridview.selectedrows and change the status to printed. Now the problem is that if the datagridview is sorted by status, when the status is changed from new to printed, that row is moved from being under new to printed and all the code after is executed on the next row. Here is what the code looks like.
Expand|Select|Wrap|Line Numbers
- For Each row As System.Windows.Forms.DataGridViewRow In frmMain.OrderDataGridView.selectedRows
- row.Cells("status").Value = "Printed"
- row.Cells("test").Value = "test"
- Next