C # list box newlines

I am trying to print new lines in a list box on a Windows form, but / n or / r / n does not work for printing on different lines. All this prints as one element.

0
source share
2 answers

Windows.NET standard form lists do not support multiple items.

To get what you described, you either use a different control or configure the ListBox to work in different ways.

look at this link: Editable multi-line list for .NET for an example

, , Owner Drawn: Drawn Controls - ListBox

+4

Regex.Split :

foreach (string s in Regex.Split(TheStringContainigTheNewLines, "\n"))
    lbMyListBox.Items.Add(s); 
+2

All Articles