listbox alphabetical order 
Author Message
 listbox alphabetical order

Is there a way that a listbox can be sorted in to alphabetical order, A - Z
and Z - A  ???

 _____________________
| aaaa                                  |
| bbbb                                 |
| cccc                                  |
| dddd                                 |
| eeee                                  |
|                                          |
|                                          |
|_____________________|

thankx....



Thu, 10 Jul 2003 01:53:43 GMT  
 listbox alphabetical order
Yes there is a way you can alphabetize your listbox

just check on the ListBox Properties and you should be able to see the SORTED
and set it to TRUE

or add this line to your code

list1.sorted=true

Achilles C. Arevalo



Thu, 10 Jul 2003 02:56:54 GMT  
 listbox alphabetical order
is there a way to sort from Z to A?


Thu, 10 Jul 2003 02:57:59 GMT  
 listbox alphabetical order
lets put this a diffrent way...
I want  2 commands, like below:

 __             __
|__| a-z      |__| z-a
 _____________
| aaaa                  |
| bbbb                 |
| cccc                  |
| dddd                 |
| eeee                  |
|                          |
|                          |
|_____________|

i want it so when a-z comand is clicked, the list box is listed a-z,
and when the z-z command is ckicled , the list box is listed z-a.... get
what i mean??

hope someone can help,
thankx
hippo.



Thu, 10 Jul 2003 03:44:24 GMT  
 listbox alphabetical order


Quote:
> lets put this a diffrent way...
> I want  2 commands, like below:

>  __             __
> |__| a-z      |__| z-a

no, you can not sort in descending order and you can't change the Sorted
property at runtime.  You'll need to leave Sorted=False and then write your
own code to sort the data and rebuild the list.


Thu, 10 Jul 2003 04:43:53 GMT  
 listbox alphabetical order

Quote:
> or add this line to your code
> list1.sorted=true

You can't do this during runtime in your code.

Regards, Otser.



Thu, 10 Jul 2003 05:00:46 GMT  
 listbox alphabetical order
http://www.thescarms.com/vbasic/CabExplorer.htm

explains exactly how to do, & with multiple columns too!!

--
best regards,
hapticz

|Is there a way that a listbox can be sorted in to alphabetical order, A - Z
|and Z - A  ???
|
| _____________________
|| aaaa                                  |
|| bbbb                                 |
|| cccc                                  |
|| dddd                                 |
|| eeee                                  |
||                                          |
||                                          |
||_____________________|
|
|
|thankx....
|
|



Thu, 10 Jul 2003 05:52:28 GMT  
 listbox alphabetical order


Quote:
>Is there a way that a listbox can be sorted in to alphabetical order, A - Z
>and Z - A  ???

Hi HiPpo, try this...

A new VB6 .exe with List1 (Sorted=True), List2 (Sorted=False) and button
btnRev. List1.Visible could be set to False.

============================================
Option Explicit

Private Sub Form_Load()

    List1.AddItem "bbbbb"
    List1.AddItem "ccccc"
    List1.AddItem "fffff"
    List1.AddItem "ggggg"
    List1.AddItem "jjjjj"

End Sub

Private Sub btnRev_Click()

    Dim i As Integer
    If List1.ListCount > 0 Then
        List2.Clear
        For i = List1.ListCount - 1 To 0 Step -1
            List2.AddItem List1.List(i)
        Next i
    End If

End Sub
============================================

HTH

Regards,

--
Martin Trump



Thu, 10 Jul 2003 08:06:33 GMT  
 listbox alphabetical order
thankx that works.....
Quote:
> Hi HiPpo, try this...

> A new VB6 .exe with List1 (Sorted=True), List2 (Sorted=False) and button
> btnRev. List1.Visible could be set to False.

> ============================================
> Option Explicit

> Private Sub Form_Load()

>     List1.AddItem "bbbbb"
>     List1.AddItem "ccccc"
>     List1.AddItem "fffff"
>     List1.AddItem "ggggg"
>     List1.AddItem "jjjjj"

> End Sub

> Private Sub btnRev_Click()

>     Dim i As Integer
>     If List1.ListCount > 0 Then
>         List2.Clear
>         For i = List1.ListCount - 1 To 0 Step -1
>             List2.AddItem List1.List(i)
>         Next i
>     End If

> End Sub
> ============================================

> HTH

> Regards,

> --
> Martin Trump



Thu, 10 Jul 2003 08:11:26 GMT  
 listbox alphabetical order
Is there any way that it can be one useing only the one listbox?


Thu, 10 Jul 2003 08:12:58 GMT  
 listbox alphabetical order


Quote:
>Is there any way that it can be one useing only the one listbox?

HiPpO, yes but why bother? Anyway, try this. List1 has .

A new VB6 .exe with a List1 (Sorted = False) and a btnrev

Option Explicit

Private Sub Form_Load()

Dim i As Integer, sorted As Boolean, temp

    List1.AddItem "aaaaa"
    List1.AddItem "hhhhh"
    List1.AddItem "wwww"
    List1.AddItem "xxxxx"
    List1.AddItem "ccccc"
    List1.AddItem "qqqqq"

End Sub

Private Sub btnrev_Click()

    Dim sorted As Boolean, i As Integer, temp

    'Crude bubble sort max down to min...
    Do
        sorted = True
        For i = 0 To List1.ListCount - 2
            If List1.List(i) < List1.List(i + 1) Then
                temp = List1.List(i)
                List1.List(i) = List1.List(i + 1)
                List1.List(i + 1) = temp
                sorted = False
            End If
        Next i
    Loop Until sorted

End Sub

HTH

Regards,

--
Martin Trump



Thu, 10 Jul 2003 09:01:17 GMT  
 listbox alphabetical order


Quote:
>HiPpO, yes but why bother? Anyway, try this. List1 has .

Whoops, a boo-boo here at Trump Towers :-)

That should read...

List1 has .Sorted = False.

Sorry about that.

Regards.

--
Martin Trump



Thu, 10 Jul 2003 09:19:33 GMT  
 listbox alphabetical order

Quote:

HiPpO

> >Is there a way that a listbox can be sorted in to alphabetical
order, A - Z
> >and Z - A  ???
...
> A new VB6 .exe with List1 (Sorted=True), List2 (Sorted=False) and
button
> btnRev. List1.Visible could be set to False.

...

Wouldn't it be much easier and intuitive to the user to use a
ListView control and set the sortkey to the column header clicked,
toggling the sort direction when the clicked header is already the
sort key?



Thu, 10 Jul 2003 14:00:27 GMT  
 listbox alphabetical order
Thankx alot :) thats really helped
--
Yours Electronically,
Mick


Quote:


> >Is there any way that it can be one useing only the one listbox?

> HiPpO, yes but why bother? Anyway, try this. List1 has .

> A new VB6 .exe with a List1 (Sorted = False) and a btnrev

> Option Explicit

> Private Sub Form_Load()

> Dim i As Integer, sorted As Boolean, temp

>     List1.AddItem "aaaaa"
>     List1.AddItem "hhhhh"
>     List1.AddItem "wwww"
>     List1.AddItem "xxxxx"
>     List1.AddItem "ccccc"
>     List1.AddItem "qqqqq"

> End Sub

> Private Sub btnrev_Click()

>     Dim sorted As Boolean, i As Integer, temp

>     'Crude bubble sort max down to min...
>     Do
>         sorted = True
>         For i = 0 To List1.ListCount - 2
>             If List1.List(i) < List1.List(i + 1) Then
>                 temp = List1.List(i)
>                 List1.List(i) = List1.List(i + 1)
>                 List1.List(i + 1) = temp
>                 sorted = False
>             End If
>         Next i
>     Loop Until sorted

> End Sub

> HTH

> Regards,

> --
> Martin Trump



Thu, 10 Jul 2003 15:20:44 GMT  
 listbox alphabetical order


Quote:
>Wouldn't it be much easier and intuitive to the user to use a
>ListView control and set the sortkey to the column header clicked,
>toggling the sort direction when the clicked header is already the
>sort key?

Glenn, I'm sure you're right but I have still to get to grips with all
the VB6 goodies beyond VB3.

Regards,

--
Martin Trump



Fri, 11 Jul 2003 06:52:42 GMT  
 
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 

1. to cross a table in alphabetical order

2. Printing documents in alphabetical order

3. Print documents in alphabetical order

4. Print documents in alphabetical order

5. Automatic alphabetical order

6. Alphabetical order

7. Help, dir : how to class files by alphabetical order

8. DBCombo to show fields in alphabetical order

9. sorting array values in alphabetical order

10. Alphabetical Order

11. Alphabetical order

12. Sort strings in alphabetical order

 

 
Powered by phpBB® Forum Software