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
Printable View
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
I'm somewhat confused. If all you want to do is add items, use the following:
Code:List1.AddItem "MyItem"
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.
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.
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.
the ListBox control Can support multicolumns, but the columns are like this
I assume you want it like thisCode:|====================|
|= 1 4 7 10 13 =|
|= 2 5 8 11 14 =|
|= 3 6 9 12 15 =|
|====================|
am I right?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=|
|=====================|
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]
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):
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).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
Good luck!