I manually select certain rows of a datagridview then click a button to output those rows to a file. But the order in which they are printed seems to be the reverse order from the order in which I selected them. Is this the expected behavior? Not a problem to loop backwards through the list, but I need to know if it will always be the case (note that selecting all rows using Control-A also seems to output them in the reverse order also).
This is the code I'm using.
Code:Dim sw As StreamWriter 'code not shown here to set up sw Dim Arow As DataGridViewRow Dim nrow As Integer = 0 Dim ndel As Integer = dgvLots.SelectedRows.Count For i as integer = 0 To ndel - 1 Arow = dgvLots.SelectedRows(i) nrow += 1 OutputRow(sw, Arow) Next MessageBox.Show(nrow.ToString & " written.")




Reply With Quote