help with alignment in list box

Thread Solved

Join Date: Oct 2009
Posts: 3
Reputation: ivankenny is an unknown quantity at this point 
Solved Threads: 0
ivankenny ivankenny is offline Offline
Newbie Poster

help with alignment in list box

 
0
  #1
31 Days Ago
Call List3.AddItem(txtname & vbTab & txtamount & vbTab & txtqan & _vbTab & Format$(ans, "Currency"))


need help need to align the text the keep displaying like this:

toy car 1 $3.00 $3.00
card board box1 $0.50 $0.50
remote control car 1 $3.00 $3.00
cart 1 1 $1.00 $1.00

this is just the sample need it to look clean need help please the out put must be:

toy car 1 $3.00 $3.00
card board box 1 $0.50 $0.50
remote control car 1 $3.00 $3.00
cart 1 $1.00 $1.00
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 10
Reputation: Celt.Max is an unknown quantity at this point 
Solved Threads: 4
Celt.Max Celt.Max is offline Offline
Newbie Poster
 
0
  #2
31 Days Ago
These two lists looks both the same. I guess this web didn't formated them well, so I don't now, what do you want to do with them exactly, but if you just want to make the lists aligned into nice columns, then try:

1) Right click on listbox and choose properties
2) Check gridlines (optionally, you'll see the cells then)
3) Set the view combo on value 3 - Report (thats necessary)
4) Set label edit on Manual (optionally, in the other case the first cell is editable by user as I remember)
5) Click on the "Column headers" tab and click four times on Insert column (necessary if you want to use my code below)
6) You can also name your columns, set their width, ...

then, for filling the list, use this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim itmLIST3 As ListItem
  2.  
  3. Set itmLIST3 = List3.AddItem(txtName)
  4. itmLIST3.SubItems(1) = txtamount
  5. itmLIST3.SubItems(2) = txtqan
  6. itmLIST3.SubItems(3) = Format$(ans, "Currency")

This should work...
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 809
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 147
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark
 
1
  #3
31 Days Ago
Celt.Max,
the code you are using is for the VBA Listbox control found in Excel, access, etc. and while it is usable from VB6, it is not redistributable...

IvanKenny,
There are two ways in which to accomplish what you want...
1.) Use a listview control.
2.) Do a bit of subclassing on the listbox. See... http://www.thescarms.com/vbasic/listbox.aspx



Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC