Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling listbox with multiple columns question. 1

Status
Not open for further replies.

IndigoDragon

Programmer
Aug 2, 2005
57
NL
Hi everyone,

Farely basic question I guess, but how do I add items to a listbox with multiple columns? I mean, how do I add values to the different columns of one index item?
I can't get the syntax right doing it with .AddItem and .Column() is a read-only property (right?).

ThanX for your replies.
 
Try this code

ListBox1.AddItem "helpme"
ListBox1.Column(1, ListBox1.ListCount - 1) = ("adios")

This works for me.
Chris
 
It works only if ColumnsCount is set to the maximum number of columns (in Properties or in code):
Code:
Private Sub UserForm_Activate()
 ListBox1.ColumnCount = 3
 ListBox1.AddItem "helpme"
    ListBox1.Column(1, ListBox1.ListCount - 1) = ("adios")
    ListBox1.Column(2, ListBox1.ListCount - 1) = ("TEST")
End Sub

Fane Duru
 
Hi ck1999,

Thanks for that!
And how would I get the checked value in a selection-styl listbox?

Greetz!
 
Got it!
Code:
myListbox.Selected(index)
thanx for your replies guys/girls!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top