|
-
Dec 30th, 1999, 03:01 AM
#1
Can somebody please help me
How do you create a list box that uses columns (so that more than one detail of an item added to a list box, can be shown at once).
I would be very grateful if anyone could help.
-
Dec 30th, 1999, 05:27 AM
#2
_______
'set tab stops in a listbox
'appears as columns
'
Option Explicit
'
Public Declare Function SendMessageArray Lib _
"user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Const LB_SETTABSTOPS = &H192
'<<<<< code for form >>>>>
'
Private Sub Command1_Click()
List1.AddItem "Nothing More"
List1.AddItem "Nothing Less"
List1.AddItem "Just A Sample"
Dim r As Long
'set up the tabstops in the listboxes
ReDim TabStop(1 To 3) As Long
'assign values to the tabs for the second third and fourth
'column (the first is flush against the listbox edge ie...0)
TabStop(1) = 80
TabStop(2) = 160
TabStop(3) = 240
'set the tabs
r = SendMessageArray(List1.hwnd, LB_SETTABSTOPS, 3, TabStop(1))
List1.Refresh
List1.AddItem "...A lesson" & vbTab & "in creating" & vbTab & "columns" & vbTab & "in a listbox!"
End Sub
-
Dec 30th, 1999, 05:29 AM
#3
_______
If you are using a database and datacontrol you can also do this.
'combine two fields from a database
'and display them as one field in a listbox
Dim CombinedFields as String
Dim strSQL as String
strSQL = "SELECT *, FirstField & ', ' _
& SecondField as CombinedFields FROM YourTable;"
Data1.RecordSource = strSQL
DbList1.ListField = "CombinedFields"
-
Dec 30th, 1999, 06:47 AM
#4
New Member
I'm triying to find out how to fill this lists too. If you know something tell me!
The databound controls let you see the data of a table in a multiple column list but if you don't have it in a table u can't do it.
Somebody tell me something about an array, could someone help us!
-
Jan 1st, 2000, 02:43 AM
#5
New Member
Hi!, I finally find out how to do it, it's very simple.
If you have a listBox, the propertie Columns has the value of the number of columns to show up. In runtime just type
ListBox1.AddItem Item1 & vbTab & Item2 & vbTab & Item3
And so on, you just have to insert a Tab between the values you want to put in a List Box. I hope it work for you!
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
|