Solved

Newline in listbox

Posted on 2009-03-31
2
732 Views
Last Modified: 2012-08-13
Hi,
How can I make a newline in a listbox?

I get a strange sign in my text box when I use:
\n
and also when I use
Enviorment.newline.

I ad to listbox like this:
listBox2.Items.Add(output);

0
Comment
Question by:Mickeys
2 Comments
 
LVL 6

Assisted Solution

by:HarryNS
HarryNS earned 150 total points
Comment Utility
Text box and List box are two different controls with different behaviours and purpose.

In text box, the whole content is text... Whether one line or multiple... Completely its single string information.

But In List box, each line is called list item... Each item itself is an object having its own behaviour...
0
 
LVL 4

Accepted Solution

by:
amazingwolf1 earned 350 total points
Comment Utility
In a list box, do this:
listBox.Items.Add("1");
listBox.Items.Add("");
listBox.Items.Add("2");

as for the textbox:
txt.TextMode = TextBoxMode.MultiLine; // determine its has more then one row
txt.Text = "First row\r\nsecond Row"; // use /r/n  to open a new line

HTH

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
C# single quoting a dynamical sql statement. 4 32
asp.net mvc5 3 35
String manipulation 15 49
Visual Studio 2013 debugging 2 14
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now