Vitaly
Vitaly

Reputation: 75

How to sort the values in a dataGridView Row Cells[0] so that they were in the same order that textbox.lines[i]?

Hello! I have question: textbox text multiline contains values: Samaccountname1 Samaccountname2 Samaccountname3 etc... dataGridView Row Cells[0] contain the same values but they are located in a different order: Samaccountname2 Samaccountname1 Samaccountname3

Could you tell (if it possible) how to sort the values in a dataGridView Row Cells[0] so that they were in the same order that textbox.lines[i]? dataGridView moved to the form from the Toolbox (not created programmatically). There is such data: enter image description here

Need to sort here so: enter image description here

Upvotes: 0

Views: 137

Answers (1)

Na'il
Na'il

Reputation: 29

If you use the first column in the dataGridView (because using just cells[0]) , try this code may help you :

dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic;

Upvotes: 1

Related Questions