Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkedlistbox Multicolumn

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?

like image 980
Andre Hoffmann Avatar asked Sep 18 '15 07:09

Andre Hoffmann


2 Answers

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.

like image 61
Reza Aghaei Avatar answered Sep 21 '22 13:09

Reza Aghaei


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'.

like image 33
RealCG Avatar answered Sep 20 '22 13:09

RealCG