Listbox order: using vbscript

by "Peter Karwacki" <kayaky(at)hotmail.com>

 Date:  Fri, 14 Apr 2000 17:06:46 GMT
 To:  hwg-languages(at)hwg.org
  todo: View Thread, Original
This script changes the order of a listbox with a mouseclick.
It is sent in response to a question raised yesterday

Private Sub List1_Click()
Dim intcount As Integer, intlistcount As Integer
intlistcount = List1.ListCount              'remembers the original number 
of items in the list
intcount = List1.ListIndex                  'remembers the position of the 
item selected in the list

For i = intcount To intlistcount - 1        'adds to list, from selected 
item to bottom of list
    List1.AddItem (List1.List(i))
Next
For i = 0 To intcount - 1                   'adds to list, from beginning to 
selected item
    List1.AddItem (List1.List(i))
Next
For i = 0 To intlistcount - 1               'deletes all the original items
    List1.RemoveItem (0)
    Next
End Sub

Peter Karwacki
234 Kennedy Lane West
Orleans, Ontario
K1E 1G7
hm 613-834-3859
wk 613-235-1000 ext 251

"It was getting boring on the middle of the road
- so I headed for the ditch"
Neil Young

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA