Sort datagridview column 1 then column 2

Visual Basic 2005.
Databound form.

I have this code in form load:
 Me.MyDataGridView.Sort(MyDataGridView.Columns(1), System.ComponentModel.ListSortDirection.Ascending)

I need sample code to sort column 2 (the rows would sort by column 1 first and then by column 2).
dave_skyAsked:
Who is Participating?
 
ToFroCommented:
If the DataSource for MyGridView is a BindingSource, try this(replace column names):

MyBindingSource.Sort = "column1name ASC, column2name ASC"
0
 
dave_skyAuthor Commented:
Excellent!

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.