|
-
Aug 21st, 2005, 11:11 PM
#1
Thread Starter
Lively Member
[RESOLVED] list10.column(0).additem? hah!
VB Code:
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
-
Aug 21st, 2005, 11:23 PM
#2
Re: list10.column(0).additem? hah!
to add items to the columns in a list box do
VB Code:
Me.List10.AddItem rst!QnsID &";" & rst!Question
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 22nd, 2005, 12:46 AM
#3
Thread Starter
Lively Member
Re: list10.column(0).additem? hah!
 Originally Posted by dannymking
to add items to the columns in a list box do
VB Code:
Me.List10.AddItem rst!QnsID &";" & rst!Question
Hey dannymking,
thanks for replying. i understand that, that will add items from the table into the listbox's only column.
what if i have two columns? how do i put QnsID and Question into column 1 and 2 of the listbox respectively.
Thank you.
Astro
-
Aug 22nd, 2005, 03:15 AM
#4
Re: list10.column(0).additem? hah!
On design of the form.
Select the listbox.
Open the properties window.
Look for columns, and change to 2 (or more).
I think there is a column widths property too, so if you need to hide one just set that column to 0.
In access I think the column widths were separated by semi-colons ( ; )'s might be the same in VB?
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Aug 22nd, 2005, 03:34 AM
#5
Thread Starter
Lively Member
Re: list10.column(0).additem? hah!
 Originally Posted by Ecniv
On design of the form.
Select the listbox.
Open the properties window.
Look for columns, and change to 2 (or more).
I think there is a column widths property too, so if you need to hide one just set that column to 0.
In access I think the column widths were separated by semi-colons ( ; )'s might be the same in VB?
yup Ecniv, i've already one that. just need to additem into it's respective column.
Thanks
-
Aug 22nd, 2005, 03:40 AM
#6
Re: list10.column(0).additem? hah!
Code:
listbox.additem ""
lngLast = listbox.listcount -1
listbox.list(lngLast,0)="ID"
listbox.list(lngLast,1)="Disp data"
Something like that?
I am not sure it is list, but you should have the intellisense, have a look through that. Might be listitem. Or Item (sorry cannot remember!)
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Aug 22nd, 2005, 08:17 PM
#7
Thread Starter
Lively Member
Re: list10.column(0).additem? hah!
Hey Ecniv,
I got it man.
Me.List10.AddItem rst!QnsID & ";" & rst!Question & ";"
Thanks anyway! =)
Astro
-
Aug 23rd, 2005, 03:21 PM
#8
Re: list10.column(0).additem? hah!
As I originally stated..
Been off work for a week and a half, and not had much chance to visit recently due to training course in manchester.
When you specify .AddItem and include a semicolon between two items you are infact adding to both columns, or three if you include two semicolons and so on..
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 24th, 2005, 08:21 PM
#9
Thread Starter
Lively Member
Re: [RESOLVED] list10.column(0).additem? hah!
Hey dannymking,
I got it!
Thanks!
Astro
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|