Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8912229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:08:53+00:00 2026-06-15T04:08:53+00:00

Trying to sort a arraylist by Objects name Dim ObjList as new arraylist Dim

  • 0

Trying to sort a arraylist by Objects name

Dim ObjList as new arraylist
Dim TextBox1 as new textbox
Textbox1.name = "CCC"
Dim TextBox2 as new textbox
Textbox1.name = "AAA"
Dim TextBox3 as new textbox
Textbox1.name = "BBB"
ObjList.add(TextBox1)
ObjList.add(TextBox2)
ObjList.add(TextBox3)
ObjList.sort()

Sort creates a error. How would I sort the TextBoxs by Name so it looks like
AAA
BBB
CCC

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:08:54+00:00Added an answer on June 15, 2026 at 4:08 am

    You have to create an IComparer and pass it to the Sort method:

    Class TextBoxComparer 
        Implements IComparer
    
        Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
            Return String.Compare(x.Name, y.Name)
        End Function
    
    End Class
    
    ...
    
    ObjList.Sort(New TextBoxComparer())
    

    Or, if you can switch to List(Of TextBox), an anonymous function (that matches the Comparison(Of T) delegate) will also do:

    Dim ObjList As New List(Of TextBox)
    
    ...
    
    ObjList.Sort(Function(x, y) String.Compare(x.Name, y.Name))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to sort through an arraylist of objects by a particular value within
I'm trying to use Collections.sort on a ArrayList of custom objects, but I'm getting
I was trying to sort my ArrayList. java.util.ArrayList arList= new java.util.ArrayList(); arList=getList(); java.util.Collections.sort(arList); where
I'm trying to sort a Documents Collection using a java.util.ArrayList. var myarraylist:java.util.ArrayList = new
I'm trying to sort an ArrayList by BigDecimal and coming up against a brickwall.
Trying to sort this array of objects according to (1) depth and (2) weight,
I'm setting up a new store using 1.4.1 I'm trying sort the products in
I'm trying to sort an ArrayList in my Android app, but its throwing an
I'm trying to sort an ArrayList of custom items and get 'At least one
Im trying to put arraylists into an arraylist. Adding data to the new arrays,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.