listbox headings


in the listbox CellAction i have as follow:

textfield1.Text = me.Heading(2)

so i can get the text of the heading 2

My question is how i can get the text for each heading columns?

i did this :

dim i as integer

for i = 2 to 60

textfield1.text = me.heading(i)

but what i get is the last heading text (the heading of column n. 60)

any suggestion?


The issue is in

textfield1.text = me.heading(i)

Think about what that does for a second.
If you want all of the headings to appear, you would need to append each one to the textfield.

Have you seen the Introduction to Programming with Xojo guide?

Hi Tim

Thanks for your suggestion, but i want to make a point:

I have read the introduction to programming with Xojo since i bought xojo (Desktop, Web, IOS) some years ago and i tried to understand how to program with xojo.

Im a textil engineer that like to program for hobby and Xojo is a great tool for people like me that is very basic and stupid for you or your level.

So what seems very easy to you , maybe can be very hard to me even if i read about it, because im not use to think like a programmer. Thats why there are teachers in this world. They teach to people like me to think in the right way.

Im using you in this forum as teachers, with the hope to get your level some day.

Sorry to disturb anybody with my stupid questions.

In your loop, you keep replacing the entire text by the current me.heading(i). So you end up with the last one.

What you need to do is to add me.Heading(i) at every cycle.

I am not sure a TextField is the right choice to show all the headers. You may want to use a TextArea instead, and as advised by Tim, check its AppendText method. Also, use EndOfLIne to have items show on new lines.

Not everyone learns the same way. We have 65+ hours of video training for Xojo at This is over 200 videos on hundreds of topics and practically all of them come with the source code so you can use them in your own projects. We have two start to finish desktop projects and one start to finish web application.

Thanks Bob

I will for sure!!!

To Michel & Bob:

im sure i have not explained well myself so i will try in this way:

i have a listbox with 5 column with heading : A, B C, D E

i havw 5 rows: 1,2,3,4,5

So what i want is when i click in the column A and row 1 i want to get a value like this A1 ans so on B2 if clickin in the Column B row 2

is that possible?


Sure. Look at Listbox.CellClick event and use the Column property to get the heading property. You can then add that to the contents of the cell and do whatever you want with it. You’re learning and half the battle is to figure out control (listbox) events to access its properties and then shove the result into a TextField.

I’d take it a step at a time.

  1. Load the listbox (header and row) with data
  2. use the Cell click event to get the cell contents AND the heading
  3. Concatenate the strings and put that string into a textField.

Hi Bob

Your great thanks!!!

textfield1.text = me.heading(column)+str(row)

in cell click event

Hi Dave

You save my day!!!


FYI: if you want to get all headings at once use

TextField1.Text = Me.Heading(-1).ReplaceAll(Chr(9), ", "))   // Chr(9) is the Tab character