Results 1 to 4 of 4

Thread: ListBox

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    4

    Cool

    Hello, i'm trying to insert items into a list box, but I can't seem to get it to do an insert. The additem always adds an item to the end. I tried setting the listindex and
    then doing my additem, but it still adds to the bottom of the list. Here's a sample of my problem

    listbox1
    --------
    Vehicle Type
    1979 Buick cutlass
    1990 Corevette Convertable
    1972 Chrysler Cordoba
    Property Type
    Commercial

    I have a prefilled listbox with vehicles and property types. I want to highlight a vehicle and click add. The vehicle should then show up on listbox2, which it does.

    but if I add a vehicle, then a property type, and then
    a vehicle, the list looks like:

    listbox2 after user highlights and adds items from listbox1.
    ------------------------
    Vehicle Type
    1979 Buick cutlass
    Land Type
    Commercial
    1990 Corevette Convertable - *** item, should be
    under vehicle types.

    how do you add items in a middle of a list.

    thanks................

  2. #2
    Member
    Join Date
    Dec 1999
    Posts
    41
    Two ways
    1) Set sorted property to TRUE
    2) Add the item at the desired position..Check Additem method documentation

  3. #3
    Guest
    Code:
    Private Sub Command2_Click()
    i = List1.ListIndex
    List1.AddItem "hhh", i
    End Sub

  4. #4
    Lively Member
    Join Date
    Mar 2000
    Posts
    82
    it sounds like you would be better off using the treeview control, that is if you don't mind adding to the size of the program.
    VB 6.0 Pro | VC++ 6.0

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