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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add items to a multi-column Listbox?

Status
Not open for further replies.

Butane

Technical User
Oct 20, 2001
8
0
0
GB
I have a listbox with three columns, i can add items to the first column but not to the second or third.
Ive tried using Additem but it only adds the items to seperate rows and not to the same row in the first and second column. Ive tried using this:

ListBox1.AddItem TextBox1.Text
ListBox1.AddItem TextBox2.Text

Is there some other command that i dont know about or is my code just wrong? Im new to VBA so its probably me being dumb.

Thanks anyway
Henry
 
You can use the List property to assign values to each column. Assuming a two-column list box, this code assigns values to the two columns of the first row of ListBox1:

ListBox1.List(0, 1) = "Row 1, Col 1"
ListBox1.List(0, 2) = "Row 1, Col 2"
 
MANY Thanks thats sorted it all out!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top