Does anyone know how to create multiple columns in a listbox? Like the ones that you would find in Outlook Express and stuff.
Printable View
Does anyone know how to create multiple columns in a listbox? Like the ones that you would find in Outlook Express and stuff.
List1.Additem "Hello" & vbTab & "World"
You could use the listview control instead
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.
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 thisCode: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"
The last two 1's are for the icon properties.Code:Listview1.Listitems.Add 1,,"Hello",1,1
Good luck.
Thanks a lot guys. I've been wondering how they do that for a while.