Merging Listbox Cells - How to?

How would you go about merging adjacent listbox cells? In the example below I have three headers with two sub-headers for each. I would like to make the header cells straddle their two respective sub-headers (sorry for the poor description, I’m thinking in Excel terms).

Listbox1.AddRow("Heading1", "", "Heading2", "", "Heading3") // <== header row Listbox1.AddRow("Param1", "Param2", "Param1", "Param2", "Param1", "Param2") // <== sub-header row Listbox1.AddRow( "100", "4", " 50", "10", "50", "50") Listbox1.AddRow( "250", "10", " 125", "25", "125", "125") Listbox1.AddRow( "600", "24", " 300", "60", "300", "300") Listbox1.AddRow( "1500", "60", " 750", "150", "750", "750") Listbox1.AddRow( "3200", "128", " 1600", "320", "1600", "1600")

Have a look at the last three posts here:

Thanks, I’m looking into Einhugur and “Merged Cells Listbox”. Also comtemplating other ways to “skin the cat”.

If you want the header to always stay at the top, the simplest way is to use two listboxes with the top one having the first header row and th second the sub-header and data rows…

That is easy unless you want resizable columns or horizontal scrolling which takes some work.

My class will merge regular cells across both rows and columns … but can not do anything with the listbox header.

  • Karen

That’s what I did previously for a different app. I wasn’t sure if I could use a similar approach, but after rethinking what I need, I am trying that. What I need is a table I can format during design, it will not be resized at runtime; so I believe this approach will work. Thanks for the tip. I am, however looking at the two grid/listbox plugins as they seem pretty flexible.

Well I’m partial to the 'Merged Cells Listbox" … but then again I wrote it! :wink:

  • Karen

Using multiple listboxes resolved the immediate need. I still have another need which will be a lot easier with one of the two plugins.

Using single listbox

Using multiple lisboxes