Question

Is there a way to bind a Generic List to a multicolumn listbox, yes listbox...I know but this is what I am stuck with and can't add a grid or listview.

Thanks

Was it helpful?

Solution

You could bind a list to a listbox like this:

List<int> list = new List<int> { 1, 2, 4, 8, 16 };
listBox1.DataSource = list;

As for multicolumn listbox documentation says ListBox.MultiColumn only places items into as many columns as are needed to make vertical scrolling unnecessary.

If you want to show several columns of information for which an entire row will get selected you could use Multi Column List Box by Chris Rickard.

OTHER TIPS

For .NET 2.0 you can use the UseCustomTabOffsets and CustomTabOffsets, if you need multi-column support in your ListBox. See how to make more than 2 column's in ListBox using C#? for an example of use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top