Insert line break in text through code

J

Julia B

Hi all

I've got a bit of code that inserts some text into a text field on a webform
under certain circumstances. The text needs some line breaks in it. This is
what I've done.

Me.OptionalNotesTB.Text = _
"- Unless otherwise offered in this quote no System Data
Requirement Lists " + _
"or other technical documentation is included. " + _
"Should these be required then we would be pleased to quote
for them separately. <br>" + _
"- Stock subject to prior sales. <br>" + _
"- Delivery charges will apply where appropriate. <br>" + _
"- The company has a minimum order charge of $250.00."

Unfortunately this doesn't seem to work. The text displays as follows:

"- Unless otherwise offered in this quote no System Data Requirement Lists
or other technical documentation is included. Should these be required then
we would be pleased to quote for them separately. <br>- Stock subject to
prior sales. <br- Delivery charges will apply where appropriate. <br- The
company has a minimum order charge of $250.00."

How do I convert the <br> into a line break?

Thanks in advance.
Julia
 
I

Ian

Line breaks with html... i.e. <br> only work with the literal control I
believe. What I have used in my code is \n, this is a line break that works
with text boxes and the like. Also you could use a resources file and type it
exactly how you want it but use Shift+Enter when you want a new line.
 
J

Julia B

Thanks Ian,

I've tried replacing <br> in my code with \n and it hasn't made any
difference other than \n displays in the text box.

I don't understand what you mean by using a resources file?

Julia
 
L

Lloyd Sheen

Julia B said:
Thanks Ian,

I've tried replacing <br> in my code with \n and it hasn't made any
difference other than \n displays in the text box.

I don't understand what you mean by using a resources file?

Julia

Since it appears you are using VB as language it does not know what \n is.
Use Environment.NewLine as the line break in your code and all should be
good.

Hope this helps
LS
 
I

Ian

Ahh yes, didnt switch my thinking... used to C#, Environment.NewLine should
do the same thing.
 

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

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top