1

I have the following but need to add more columns to filter by. I am getting errors with the syntax I am trying.

Dim ldv1 As System.Data.DataView
ldv1 = tbl1.DefaultView
ldv1.Sort = (tbl1.Columns(0).ColumnName) & " Asc" <-- I want to add to this

I am trying to do something like this but failing:

ldv1.Sort = (tbl1.Columns(0).ColumnName) & " Asc",(tbl1.Columns(1).ColumnName) & " Asc"

OR

ldv1.Sort = (tbl1.Columns(0).ColumnName), (tbl1.Columns(1).ColumnName) & " Asc"

Neither seems to be the correct way. How do I sort by more columns?

1 Answer 1

3

Add a , inside the string after the first Asc.

ldv1.Sort = tbl1.Columns(0).ColumnName + " Asc, " + tbl1.Columns(1).ColumnName + " Asc"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.