Search code examples
c#winformsweb-controls

RepeatDirection Property for CheckedListBox C#


so I'm very confused here. I want to make my multilined CheckedListBox to be sorted horizontally. I've done some research and it is all leading to the RepeatDirection property. Example in the MSDN

But I don't have a web page and I don't know any XML. Can't I just somehow use this property for the CheckedListBox Control? The MSDN people say it is already a property of that Control as they simply have written:

public virtual RepeatDirection RepeatDirection { get; set; }

I just can't seem to understand how to implement this in my code! Thanks in advance.

EDIT: I don't have a web form! It is a System.Windows.Formsproject. I just tagged web-controls because the RepeatDirection property seems to exist in the System.Web.UI.WebControls namespace.


Solution

  • Short answer: You can't. ListBox as implemented in the Windows Forms does not support repeating horizontally. You aren't using the web version of the control, so you can't use the web version's options.

    If you still need to display your options horizontally you will need to use a different control. Depending on your requirements, a DataGridView should be able to do what you are wanting, with some tweaking.