Add hidden dummy column in listbox


How can I add a hidden dummy column in Listbox?
For example, I get the data of 5 columns from a database, I populate the data in listbox, and want to add dummy column as a first column. Finally, listbox has a 6 columns but only 5 columns will be displayed.

Why do you not simply use the RowTag or the CellTag to store whatever info you want to store in the hidden column?

The reason why I need to get the hidden dummy column is that there is a weird issue using Jeremie listbox.
Whenever I resize the columns, the very first column value is changed abnormally.
So, my plan is to keep the first hidden column and don’t display the column as a workaround.

Just assign the columnWidth to zero

If I have 6 columns from a database, I can hide one column with columnWidth but I just get 5 and want to add a column in code when I populate the listbox.

If you know you have 6 columns, hide the first one by assigning to zero and then populate the last 5.

I seemed to make it unclear.
Database table has 5 columns, and it can’t add a column on it.
What I want to implement is just to add a column in code and hide it.

ListBox1.ColumnCount = ListBox1.ColumnCount + 1 // Add a new column

Then, in ListBox.ColumnWidths, replace the last entry with a 0 and your last Column will be ‘invisible’.

Now, if you are not talking about the ListBox Column, tell us what DataBase you are using… (SQLite, PostGre, Oracle, MySQL, …) and some people will be able to explain.

you can also query the database with an additional blank column in front and then populate it in the listbox and hide the first one.

If I use below code, then I would have 6 columns( 5 Database columns + 1 dummy ) and I think I could use the 1 dummy column by putting it into the first column OR the last column.
ListBox1.ColumnCount + 1 // Add a new column

Let me try that.

Yes, I think so. However, I don’t want to change my SQL code for this one. It’s because there are so many listbox and SQL queries.

Thank you.

It worked well !

dataList.ColumnCount = rs.FieldCount + 1
dataList.Heading(0) = “DUMMY”

Thank you again…

You don’t need to do that, just set your listbox to column count to the # of columns you want visible, and set your ‘hidden’ data into the next (or higher) column.

You can still access columns that are not visible (including cell content and cell tags) up to the maximum 64.