ListBox, COlumnHeads

JaedenRuiner

Registered User.
Local time
Today, 05:50
Joined
Jun 22, 2005
Messages
154
How do you actually set the values of the ColumnHeads with a listbox control.
I've set:
Columncount=2
ColumnWidths=;70pt
ColumnHeads=True

Now when the listbox displays I get a border around where the Heads should be, but when I add an item it just goes to the first line after the column head. HOw do I set the value of the actual column headers.

THanks
Jaeden "Sifo Dyas" al'Raec Ruiner
 
Jaeden,

The column heads reside in Row #0 of your ListBox.

If you populate the listbox with a Query, you can define
their names.

Code:
Select Field1 As Heading1,  <-- "Heading1"  is the 1st column header
       Field2 As MoreWords  <-- "MoreWords" is the 2nd column header
From   YourTable
Order By Field1

I haven't tried it, but if you are building your Listbox with the
.AddItem method, just add the desired headers first.

Wayne
 
Jaeden,
The column heads reside in Row #0 of your ListBox.
...
I haven't tried it, but if you are building your Listbox with the
.AddItem method, just add the desired headers first.

First off, i should offer that I'm not doing this in Access. MSO VBA is pretty universal, and a listbox is the same in all applications. When i've used a listbox with a RowSource in Access i've never had problems. But currently i'm doing this project in Word and Excel, and in the VBA help, it agrees with you that the column headers are supposedly Row#0, but they aren't.

I open the form, and in the UserForm_Initialize() method, I do this:
Code:
ListBox1.AddItem "Hello"
ListBox1.List(0,1) = "World"

And, no matter what I do, I get the bordered "header" at the top of the list box, and the first "entry" in the list below the empty head is "hello world" in separate columns.

Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
 
Jaeden,

Uh oh ... I don't use Word/Excel VBA.

Possible work-around syntax:

Me.YourListBox.AddItem ("Header1;Header2")
Me.YourListBox.AddItem ("Data1;Data2")

Wayne
 

Users who are viewing this thread

Back
Top Bottom