Hi Everyone,
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.se lectedrows 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.
So, like I said before, if the datagridview is sorted by the status cloumn, and 2 rows are selected. Then first row will hit the first line of code, execute it and change postion. So the 2nd row becomes the 1st row and row("status") is not changed. Any ideas on how to resolve this?
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.se lectedrows 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.
Code:
For Each row As System.Windows.Forms.DataGridViewRow In frmMain.OrderDataGridView.selectedRows row.Cells("status").Value = "Printed" row.Cells("test").Value = "test" Next
Comment