 |
| VB How-To Ask your "How do I do this with VB?" questions in this forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 12th, 2004, 01:28 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Add multi column data to listbox
How do I add multiple column data to a list box in VB6?
Regards,
Brian
|
|

April 12th, 2004, 01:55 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try this (I did not test it, just cut and paste from one of my projects.) This adds one tab stop in the list box.
As a suggestion, I prefer to use the ListView.
Marco
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_SETTABSTOPS = &H192
Dim i As Long
Dim ltab(0) As Long
ltab(0) = 30
SendMessage myListBox.hwnd, LB_SETTABSTOPS, 1, ltab(0)
myListBox.AddItem "fisrt column" & vbTab & "second column"
|
|

April 12th, 2004, 02:07 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How would I add multi-columns to a list view? Basically I want to list ID, Date, Text of various records on the screen then have the user be able to pick that record. The ID, Date, and Text will be used later for an INSERT statement.
Quote:
quote:Originally posted by marcostraf
Try this (I did not test it, just cut and paste from one of my projects.) This adds one tab stop in the list box.
As a suggestion, I prefer to use the ListView.
Marco
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_SETTABSTOPS = &H192
Dim i As Long
Dim ltab(0) As Long
ltab(0) = 30
SendMessage myListBox.hwnd, LB_SETTABSTOPS, 1, ltab(0)
myListBox.AddItem "fisrt column" & vbTab & "second column"
|
|
|

February 21st, 2008, 06:17 PM
|
|
Registered User
|
|
Join Date: Feb 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Did anyone ever answer BradLee's question? I'm having the same issue as well and would love to hear from you.
|
|

April 29th, 2008, 07:48 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello,
As, marcostraf stated, it tells and shows how a list box can hold the multi column data in single row with tab separated.
In fact, a list box is designed to have only one column and it works best for it. if you need multiple column control then, try using
- listview control (best choice)
- hierarchical flexgrid (only if you want it to work as excel sheet)
- or Adodb Datagrid (not recommended)
Give a try on these controls.
Hope this helps.
With Regards,
Raghavendra Mudugal
|
|
 |