Checkedlistbox Multicolumn

16,403

Solution 1

Although CheckedListBox has MultiColumn property and you can set it to true, but it only arranges list of items in multiple columns flowing items top to down then right, based on height of control

■ 1         ■ 5
■ 2         ■ 6
■ 3         ■ 7
■ 4

So if you really need multiple column, consider using DatGridView or ListView that are real multi column controls.

Solution 2

Setting the MultiColumn property to true doesn't allow you to add more columns manually. It just 'wraps' items to the next column instead of showing a vertical scrollbar once the items exceed the height of the CheckedListBox.

If you want a two column control, either use a grid control of some kind or a ListView control. By setting a ListView control's View property to View.Details, you can use it as a multicolumn 'grid'.

Share:
16,403
Andre Hoffmann
Author by

Andre Hoffmann

Updated on June 09, 2022

Comments

  • Andre Hoffmann
    Andre Hoffmann almost 2 years

    I have a CheckedListBox control in Windows Forms.

    I want to know who to add multi-columns to it. The MultiColumn property is set to true. I just want to know the coding to add 2 columns.

    The code I have is

    while (true)
    {
        data = SDK.GetNext("ACCHISTL", 6);
        document_details = data.Split('|');
        if (document_details[0] == "0")
        {
            if (document_details[3] == Document_nr)
            {
                lbLines.Items.su(document_details[4] + " -> " + document_details[14],true);
            }
            else
            {
                break;
            }
        }
        else
        {
            break;
        }
    }
    

    Can you please assist me on show me the correct way of doing this?