Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 12th, 2004, 01:28 PM
Registered User
 
Join Date: Mar 2004
Location: Lafayette Hill, PA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add multi column data to listbox

How do I add multiple column data to a list box in VB6?
Regards,
Brian
Reply With Quote
  #2 (permalink)  
Old April 12th, 2004, 01:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"
Reply With Quote
  #3 (permalink)  
Old April 12th, 2004, 02:07 PM
Registered User
 
Join Date: Mar 2004
Location: Lafayette Hill, PA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"
Reply With Quote
  #4 (permalink)  
Old February 21st, 2008, 06:17 PM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did anyone ever answer BradLee's question? I'm having the same issue as well and would love to hear from you.

Reply With Quote
  #5 (permalink)  
Old April 29th, 2008, 07:48 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi Colum Listbox JAdkins Classic ASP Basics 3 July 9th, 2007 01:40 AM
SOS!How to realize multi-column asp.net ListBox? xewei VS.NET 2002/2003 2 June 3rd, 2007 09:24 PM
multi column listbox or combolist in VS 2005 alexdcosta ASP.NET 2.0 Basics 2 June 23rd, 2006 11:20 AM
multi-colmumn listbox e4thenf4 Beginning VB 6 0 September 7th, 2004 01:31 PM
Adding data into multi-column listbox Ciarano VB How-To 5 March 31st, 2004 05:07 AM



All times are GMT -4. The time now is 04:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.