How do I populate multiple column list box?

Reply

Join Date: Jun 2006
Posts: 29
Reputation: BombAppetit is an unknown quantity at this point 
Solved Threads: 0
BombAppetit BombAppetit is offline Offline
Light Poster

How do I populate multiple column list box?

 
0
  #1
Aug 30th, 2006
As the title suggest, I don't know how to add item to a multiple column list box. When I do the usual

ListBox1.AddItem "haha"

it only adds to the first column. How do I populate the others?
Columns property has been set to, say, 3. I googled out this issue but none of them return any usable result.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 21
Reputation: lover99509 is an unknown quantity at this point 
Solved Threads: 1
lover99509 lover99509 is offline Offline
Newbie Poster

Re: How do I populate multiple column list box?

 
0
  #2
Aug 30th, 2006
as i understod from your message is that you want your listbox list to be like this when the ser drop down the list :-
meat milk
google hotmail
..... ....

if its so. you have to concatenate the columns like this

ListBox1.AddItem "haha"& " " & " haha2"

try it i hope this is what you want.
Last edited by lover99509; Aug 30th, 2006 at 11:41 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: How do I populate multiple column list box?

 
0
  #3
Aug 30th, 2006
Setting The Listbox to have multiple columns will not work the way you expect it to. Having a Mult-Column listbox will only show both columns, when the length of the first column is full. To illustrate this, start a new project, and drop a listbox on it. Change it's columns to 3, and add this code to form_load:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. For I = 0 To 300
  2. List1.AddItem I
  3. Next I
As you can see (depending on how "tall" you made the listbox) the first column fills up first, then the second, and third.... so on. In order to do what you want, it will take a bit of crafty programming, using the API. Check this site for further details: http://www.thescarms.com/vbasic/listbox.asp
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 29
Reputation: BombAppetit is an unknown quantity at this point 
Solved Threads: 0
BombAppetit BombAppetit is offline Offline
Light Poster

Re: How do I populate multiple column list box?

 
0
  #4
Aug 31st, 2006
oh. i tried the loop you posted. it really did populate in multiple columns. more than 3 actually since my box is rather short.
sigh. last time i did in VBA the data source based on query/table, getting it into multiple columns is straightforward. never knew in VB6, with data source being values, is an entirely different story.

anyway thanks for the suggestions
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC