Bubble Sorting Words Alphabetically-VBForums
Results 1 to 4 of 4

Thread: Bubble Sorting Words Alphabetically

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Posts
    13

    Bubble Sorting Words Alphabetically

    Hello i have a few names in a list box (string).
    How do i use bubble sorting to sort them in alphabetical order.

    Any help is appreciated
    Thanks

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,531

    Re: Bubble Sorting Words Alphabetically

    Code:
    Function Sort(ByVal list() as String)
        Dim temp as String
        For x = UBound(list) - 1 to 0 step - 1
            For y = 0 to x - 1
             If list(y) > list(y + 1) then
                temp = list(y) 
                list(y) = list(y + 1)
                list(y + 1) = temp
             End If
            Next
        Next 
    End Function
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." Charles F. Kettering

    Read articles on My Blog 101 LINQ Samples JSON Validator XML Schema Validator "How Do I" videos on MSDN VB.NET and C# Comparison Good Coding Practices VBForums Reputation Saver String Enum Super Simple Tetris Game


    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,243

    Re: Bubble Sorting Words Alphabetically

    Hi Pradeep. I have a homework assignment too but I'd rather cheat also so can you write my code for me too? Persoanlly, I think it's fine for me to get full marks even though I may have put no effort into the assignment while my classmates who have tried may not. I'm glad that you feel the same.

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Lively Member
    Join Date
    Mar 2010
    Posts
    69

    Re: Bubble Sorting Words Alphabetically

    There are also special cases for uniform alphabet usages. There are lots of solutions for this case to collect inside issue based folders to obtain the paradigm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.