Results 1 to 5 of 5

Thread: Listbox Question

  1. #1

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268

    Question

    Does anyone know how to create multiple columns in a listbox? Like the ones that you would find in Outlook Express and stuff.
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    List1.Additem "Hello" & vbTab & "World"
    Chemically Formulated As:
    Dr. Nitro

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You could use the listview control instead
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Lively Member
    Join Date
    Jun 2000
    Posts
    82
    Outlook Express has more of a ListView than a Listbox.
    The functions of a listview are quite different from a listbox though, and much more powerful, so if you're not used to it, it can be quite daunting...
    Here are some basic equivalents if you're interested
    Add a listview control to your form, go to Custom, set the View to 3 - lvwReport, click the Column Headers tab, Click Insert Column, and give it a name, then Insert another Column and give that a name.

    Code:
    List1.AddItem "Hello",0
    'Becomes
    Listview1.ListItems.Add 1,,"Hello"
    'Listviews start at 1 rather than 0
    
    List1.RemoveItem 0
    'Becomes
    Listview1.ListItems.Remove(1)
    
    List1.List(List1.ListIndex)
    'Becomes
    Listview1.SelectedItem.Text
    
    List1.ListIndex
    'Becomes
    Listview1.SelectedItem.Index
    
    List1.ListCount
    'Becomes
    Listview1.ListItems.Count
    
    'To make multiple columns like Outlook
    Listview1.ListItems.Add 1,,"Some Text"
    Listview1.ListItems(1).ListSubItems.Add 1,,"Some more text"
    If you want to add Icons to the list, you will need to put an ImageList control on your form, put some icons in it, then set the Listview control's ImageLists to the one you just put there (Also in custom/Image Lists), then if you want the first icon in the list to be attached to your list items, you add it like this

    Code:
    Listview1.Listitems.Add 1,,"Hello",1,1
    The last two 1's are for the icon properties.

    Good luck.
    Andrew Empson
    vb6(ent) SP4

  5. #5

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    Thanks a lot guys. I've been wondering how they do that for a while.
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

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