Hide and show columns

I would like the user to be able to toggle more than one column at a time in a listbox using checkboxes to indicate which columns they would like to be visible or hidden. Is there a way to do this?

I dont think you can hide and show them but you can re-populate the listbox and columns.

I think you can change the column width to zero (and remember what to restore it too when visible again). But I may not remember that right because I nearly always use a third-party control which DOES have the ability to set the visible state per column among many other even more useful things.

If you are open to third-party extensions, take a look at the demo project from piDog for their DataView product.

1 Like

Thanks for the reply. I’m working on the set the column to 0 method. It’s tricky but I think I can work it out.

You absolutely can hide columns by setting their width(s) to 0, I’ve done it in at least one app.

Thanks everyone. I’ve solved it now using your advice to set column widths to 0 to hide them. The tricky bit was keeping track of multiple columns being being toggle between hidden and visible.

Terrence, I have a trial balance displaying 12 months for each account. Clicking on a button brings up a window with a listbox listing all of the columns. Setting the first column to checkbox style the user can choose which columns they want to hide or display. When the window closes the listbox is redisplayed with the selected columns column widths set to zero to hide them. You can use the column rowtag feature to store the original column widths.