How on earth do you added data to the different columns of a multi column Listbox?
Any example would help as I can't find any anywhere
Printable View
How on earth do you added data to the different columns of a multi column Listbox?
Any example would help as I can't find any anywhere
A multi column list box has no vertical scroll bar.
When a new item is added which would normally cause a vertical scroll bar to appear, it is instead inserted into a new column to the right.
Try this : it's from MSDN and demonstrates the behaviour very well.
If you don't want behaviour like this then use a ListView in report mode instead.Code:// Add items to the ListBox.
for (int x = 0; x < 50; x++)
{
listBox1.Items.Add(string.Format("Items {0}", x));
}
// Display items in columns.
listBox1.MultiColumn = true;
// Determine the width of the items in the list to get the best column width setting.
int width = (int) listBox1.CreateGraphics().MeasureString(
listBox1.Items[listBox1.Items.Count -1].ToString(),
listBox1.Font).Width;
// Set the column width based on the width of each item in the list.
listBox1.ColumnWidth = width;
Darwen.