CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    organizing letters and numbers

    the user can enter a one letter letter or number in a listbox... How can I make it so that I can arrange the numbers and letters backwards, like this example:

    list1.list(0) = "A"
    list1.list(1) = "1"
    list1.list(2) = "B"
    list1.list(3) = "2"
    list1.list(4) = "3"

    now, I want to arrange it so that, the elements appear in this order:
    B
    A
    3
    2
    1
    how can I do that?


  2. #2
    Join Date
    Jan 2000
    Location
    CA
    Posts
    52

    Re: organizing letters and numbers

    The easiest way (I think) will be to check and compare the ASCII code value for the letter or number that is added to the list. Capital letters A-Z have ASCII values of 65-90, lower case letters A-Z have values of 97 - 122, and numbers 0-9 have values of 48-57. You will probably want to convert any letter that is entered to Upper case and sort the entries in descending ASCII value order.


    Good Luck...


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured