Conditional line break

A

andyoye

I have a form with multiple text boxes and a rich text box.

I have a button when clicked, concats the values of all text boxes and put
in History box ( rich text box)

So if the text gets dumped into the History box is: "Price is updated,
10.00am by UserA.. End"

How can I force a line break based on "End" ? so next History box is look
like below after some other user enter text.

"I am ok with new price, 10.30am UserB..End"
"Price is updated, 10.00am by UserA.. End"
.....
So when ever text ends with "End", it gets stored in History as new line
 
J

Jeff Johnson

andyoye said:
I have a form with multiple text boxes and a rich text box.

I have a button when clicked, concats the values of all text boxes and put
in History box ( rich text box)

So if the text gets dumped into the History box is: "Price is updated,
10.00am by UserA.. End"

How can I force a line break based on "End" ? so next History box is look
like below after some other user enter text.

"I am ok with new price, 10.30am UserB..End"
"Price is updated, 10.00am by UserA.. End"
....
So when ever text ends with "End", it gets stored in History as new line

myConcatenatedString = myConcatenatedString.Replace("..End",
System.Environment.NewLine);
historyRichTextBox.Text = myConcatenatedString;
 
A

andyoye

Thanks but Replace is not putting a new line.

How about w/o "End"

So how can historyRichTextBox stores values in new lines?



"
 
J

Jeff Johnson

Thanks but Replace is not putting a new line.

How about w/o "End"

So how can historyRichTextBox stores values in new lines?

Post your actual code.
 
A

andyoye

I got it working by changing the History box to a "text box" from "rich
text". I dont know why it wasn't working

String myCatString = System.Enviroment.NewLine + text1 + text2 ..........;

thanks much
 

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

Top