Insert line break in text through code

Discussion in 'ASP .Net' started by Julia B, Jan 29, 2008.

  1. Julia B

    Julia B Guest

    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
    Julia B, Jan 29, 2008
    #1
    1. Advertising

  2. Julia B

    Ian Guest

    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.

    "Julia B" wrote:

    > 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
    Ian, Jan 29, 2008
    #2
    1. Advertising

  3. Julia B

    Julia B Guest

    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

    "Ian" wrote:

    > 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.
    >
    > "Julia B" wrote:
    >
    > > 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
    Julia B, Jan 29, 2008
    #3
  4. Julia B

    Lloyd Sheen Guest

    "Julia B" <> wrote in message
    news:...
    > 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
    >
    > "Ian" wrote:
    >
    >> 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.
    >>
    >> "Julia B" wrote:
    >>
    >> > 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


    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
    Lloyd Sheen, Jan 29, 2008
    #4
  5. Julia B

    Ian Guest

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

    "Lloyd Sheen" wrote:

    >
    > "Julia B" <> wrote in message
    > news:...
    > > 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
    > >
    > > "Ian" wrote:
    > >
    > >> 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.
    > >>
    > >> "Julia B" wrote:
    > >>
    > >> > 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

    >
    > 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
    >
    >
    Ian, Jan 29, 2008
    #5
  6. Julia B

    Julia B Guest

    That did the trick! Brilliant, thanks for both your help.

    Julia

    "Ian" wrote:

    > Ahh yes, didnt switch my thinking... used to C#, Environment.NewLine should
    > do the same thing.
    >
    > "Lloyd Sheen" wrote:
    >
    > >
    > > "Julia B" <> wrote in message
    > > news:...
    > > > 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
    > > >
    > > > "Ian" wrote:
    > > >
    > > >> 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.
    > > >>
    > > >> "Julia B" wrote:
    > > >>
    > > >> > 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

    > >
    > > 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
    > >
    > >
    Julia B, Jan 29, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWFyZHk=?=

    Insert a line break in a label control

    =?Utf-8?B?TWFyZHk=?=, Jul 30, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    8,156
    =?Utf-8?B?TWFyZHk=?=
    Jul 30, 2005
  2. pavan
    Replies:
    2
    Views:
    416
    Greg Young
    May 5, 2006
  3. Replies:
    12
    Views:
    960
  4. curious
    Replies:
    1
    Views:
    174
    Patrick Spence
    Oct 25, 2006
  5. Replies:
    20
    Views:
    317
    Michele Dondi
    Jan 16, 2005
Loading...

Share This Page