|
-
Aug 24th, 2000, 11:47 AM
#1
Thread Starter
Lively Member
Hi.
How can i use a multicolumn listbox and then add columns items with the AddItem method of ListBox Control?
Thanks in advance.
PD. The ListBox style is CheckBox
-
Aug 24th, 2000, 11:59 AM
#2
I'm somewhat confused. If all you want to do is add items, use the following:
Code:
List1.AddItem "MyItem"
-
Aug 24th, 2000, 12:02 PM
#3
Thread Starter
Lively Member
Yes.Megatron
I want to add items to a listbox but it must be a multicolumn one and i want to add items in each column.
thanks.
-
Aug 24th, 2000, 12:03 PM
#4
Junior Member
Multicolumn List Box
Hi. I don't think the list boxes that come with VB support multicolumns. You should try 3rd party list boxes like APEX True DBList and Sheridan DataWidgets.
-
Aug 25th, 2000, 12:23 AM
#5
Junior Member
I just read a suggestion in another forum. Add Microsoft Forms 2.0 Object Library to your components. The combo box and list box included supports multiple columns. I think these are the standard controls of Visual FoxPro.
-
Aug 25th, 2000, 12:52 AM
#6
the ListBox control Can support multicolumns, but the columns are like this
Code:
|====================|
|= 1 4 7 10 13 =|
|= 2 5 8 11 14 =|
|= 3 6 9 12 15 =|
|====================|
I assume you want it like this
Code:
C1 C2 C3 C4 C5
|=====================|
|=C1-1=C2-1=C3-1=4-10=|
|=C1-2=C2-2=C3-2=4-11=|
|=C1-3=C2-3=C3-3=4-12=|
|=====================|
am I right?
For that you must use a ListView Control with the View property set to Report, then under the Custom Property, add the Column Headers and add the caption, etc.
The ListView Control is in Microsoft Windows Common Controls 6.0.
Dennis
[Edited by denniswrenn on 08-25-2000 at 01:58 AM]
-
Aug 25th, 2000, 03:32 AM
#7
You can set tabstops in a listbox and then add tab separated items to the listbox.
Here's an example that uses 5 columns (i.e 4 tabs):
Code:
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 As Long = &H192
Private Sub Form_Load()
ReDim TabArray(0 to 3) As Long
TabArray(0) = 49
TabArray(1) = 100
TabArray(2) = 151
TabArray(3) = 202
'Clear any existing tabs
'and set the list tabstops
SendMessage List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&
SendMessage List1.hwnd, LB_SETTABSTOPS, 4&, TabArray(0)
List1.Refresh
List1.AddItem "Col1" & vbTab & "Col2" & vbTab _
& "Col3" & vbTab & "Col4" & vbTab & "Col5"
End Sub
I used the CCRP's CoolTabs Visual Tabstop designer to generate this code. You can download it at http://www.mvps.org/ccrp (click on the "cooltools" link).
Good luck!
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
|