944,068 Members | Top Members by Rank

Ad:
Oct 27th, 2009
0

help with alignment in list box

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ivankenny is offline Offline
4 posts
since Oct 2009
Oct 27th, 2009
0
Re: help with alignment in list box
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...
Reputation Points: 11
Solved Threads: 4
Newbie Poster
Celt.Max is offline Offline
13 posts
since Oct 2008
Oct 27th, 2009
1
Re: help with alignment in list box
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
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Scanner :Scanning image of a Picture control to a Rich Text Box
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to solve this





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC