?
Solved

Newline in listbox

Posted on 2009-03-31
2
Medium Priority
?
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Assisted Solution

by:HarryNS
HarryNS earned 600 total points
ID: 24026978
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 1400 total points
ID: 24026998
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

765 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