new line

  • Thread starter Thread starter Hrvoje Voda
  • Start date Start date
H

Hrvoje Voda

name += function.Name + " ";

How to write this code but with exception to put a function.Name into a new
line ?



I want to get a string name into a list like this:

Function 1

Function 2

....



Hrcko
 
Hi Hrvoje,
try this
name += function.Name + "\r\n";
this will give a function name for every row
Function 1
Function 2
if you want a line space between functions then
name += function.Name + "\r\n\r\n";
Hope that helps.
 
Nassos said:
Hi Hrvoje,
try this
name += function.Name + "\r\n";

Instead of "\r\n", you might want to use Environment.NewLine:

name += function.Name + Environment.NewLine;

[...snip...]
 
I tried this. It doesn't work.


Nassos said:
Hi Hrvoje,
try this
name += function.Name + "\r\n";
this will give a function name for every row
Function 1
Function 2
if you want a line space between functions then
name += function.Name + "\r\n\r\n";
Hope that helps.
 
It only works when I use a textbox control.
IN comboBox and in listBox it's all in one line.
 
Hrvoje said:
It only works when I use a textbox control.
IN comboBox and in listBox it's all in one line.
[...snip...]

Sorry, I guess we misunderstood what you wanted. I undestood you asked about
creating a string, obviously you wanted to insert rows into a listbox.

So you will have to insert a new item into your box for each item you want
to show like that:

foreach(object item in myItems)
{
mylistbox.Items.Add(object.ToString)
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

what's wrong? 5
string array 4
Is there a way to refer to the Function/Sub name? 4
listview 3
sort string 10
replace values 19
checked list box 3
array list 3

Back
Top