Thow Thow - 3 years ago 253
C# Question

Visual Studio listbox text is too long

So I'm making an application for a friend of mine. This app contains a winforms listbox. The listbox contains tweets. Everything works fine but the problem is the length of the tweets. When a tweet is too long, the listbox cuts parts away. Example:


Thow tweeted: jalskjdkljasdljlasjkdlasjdlkjaslkjaskljdlasjkd...

It adds dots when the text is too long. I can't resize the listbox because then it's too big. Is there a way to make the text that's bigger then 100 pixels split into different lines?

Answer Source

If you don't need the selection capabilities of a ListBox, you could switch to a multi line line text box. Use a regular text box and set the multi line property = true. Stretch the control to the appropriate size to match that of the ListBox. Add a new tweet using :

multiLineTweetBox.Append(newTweet + Environment.NewLine);  
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download