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
| 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 August 22nd, 2005, 01:00 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default list10.column(0).additem? hah!

Private Sub Command2_Click()
Rem fetch
Me.List10.RowSource = ""
rst.Open "select * from Qns_Table", cn
rst.MoveFirst
Do While Not rst.EOF
    Me.List10.AddItem rst!QnsID
    'Me.List10.AddItem rst!Question
    rst.MoveNext
Loop
rst.Close
End Sub



is there anyway that i can have my QnsID and Question displayed in seperate column of the List10 (list box)?

i've tried something out of the world and here goes...
Me.List10.Column(0).AddItem rst!QnsID
Me.List10.Column(1).AddItem rst!Question

of course, it isn't suppose to work =P

can someone advice me on this?

Thanks

Astro

Reply With Quote
  #2 (permalink)  
Old August 22nd, 2005, 12:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

set the Columns property of the list box to something different than 1, and use vbTab to separate the columns when you add an item, like

list1.add "first" & vbtab & "second"

if you neeed more control on the layout, I suggest you switching from the ListBox to the ListView in report mode.

Marco
Reply With Quote
  #3 (permalink)  
Old March 6th, 2007, 03:51 AM
Registered User
 
Join Date: Mar 2007
Location: Tehran, Tehran, Iran.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to peace_msngr
Default

You Can Use your code such as following:

Me.List10.ColumnCount = 2
Me.List10.RowSourceType = "Value list"
Me.List10.ColumnWidths = "Xcm;Ycm" ' X & Y :any size



Private Sub Command2_Click()
Rem fetch
Me.List10.RowSource = ""
rst.Open "select * from Qns_Table", cn
rst.MoveFirst
Do While Not rst.EOF
    Me.List10.AddItem rst!QnsID & ";" & rst!Question
    rst.MoveNext
Loop
rst.Close
End Sub

This Method Creates 2 column separately. ;)

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
List box AddItem bogs down williamlove Access VBA 4 November 8th, 2008 11:46 PM
ListBox.AddItem In Access 2000 tready Access VBA 3 August 17th, 2006 01:11 PM
previous column & next column ct Excel VBA 4 August 19th, 2005 04:50 AM
template column and bound column hidayah ASP.NET 1.x and 2.0 Application Design 1 April 9th, 2005 03:50 PM
Compare two Items of data(in column A and column B ever Excel VBA 6 February 13th, 2004 02:19 PM



All times are GMT -4. The time now is 02:48 AM.


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