Hello, I a m building an email message in a StringBuilder Object and then
using the StringBuilder ToString() method to get it to regular text. It
appears to me that when I place a "\n" into the Stringbuilder object that
when this is translated into text, I loose the page break. Is this true and
I doing something wrong?
I'm guessing that I could insert a special character into the StringBuilder
object and then use the string Replace() method to translate that special
character into a "\n" and perhaps this would work.
Just wondering why it does not work when I place that value into the
StringBuilder Object.
ThanksHow are you noticing that you loose the break? In what context is this
happening?
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:1BC14F11-5DBA-4865-9CFB-2881598EB955@.microsoft.com...
> Hello, I a m building an email message in a StringBuilder Object and then
> using the StringBuilder ToString() method to get it to regular text. It
> appears to me that when I place a "\n" into the Stringbuilder object that
> when this is translated into text, I loose the page break. Is this true
> and
> I doing something wrong?
> I'm guessing that I could insert a special character into the
> StringBuilder
> object and then use the string Replace() method to translate that special
> character into a "\n" and perhaps this would work.
> Just wondering why it does not work when I place that value into the
> StringBuilder Object.
> Thanks
Have you considered using Environment.Newline instead of "\n"?
Example:
StringBuilder textBuilder = new StringBuilder(512);
textBuilder.Append("Dear John,");
textBuilder.Append(Environment.Newline)
Perhaps that will help.
carl
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:1BC14F11-5DBA-4865-9CFB-2881598EB955@.microsoft.com...
> Hello, I a m building an email message in a StringBuilder Object and then
> using the StringBuilder ToString() method to get it to regular text. It
> appears to me that when I place a "\n" into the Stringbuilder object that
> when this is translated into text, I loose the page break. Is this true
> and
> I doing something wrong?
> I'm guessing that I could insert a special character into the
> StringBuilder
> object and then use the string Replace() method to translate that special
> character into a "\n" and perhaps this would work.
> Just wondering why it does not work when I place that value into the
> StringBuilder Object.
> Thanks
Try Environment.NewLine
Remy
I am loosing the page break when I use the StringBuilder ToString() method
when I am formatting an email message. I will try the Environment.NewLine()
method and see if that retains the line break.
Does the StringBuilder cause the newline disappear, or is it something with
the mail component. What happens if you just set the
StringBuilder.ToString() to a variable and looked at it, is the newline
gone?
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:9876DF24-F310-4FDC-826D-D7872576655C@.microsoft.com...
>I am loosing the page break when I use the StringBuilder ToString() method
> when I am formatting an email message. I will try the
> Environment.NewLine()
> method and see if that retains the line break.
>
I assume you are using c?
If you pass "\n" you'll get newline > chr(10)
If you want "\n" you might consider to use "\\n"
(Outlook express mangels this for me, use slash twice)
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> schreef in bericht
news:1BC14F11-5DBA-4865-9CFB-2881598EB955@.microsoft.com...
> Hello, I a m building an email message in a StringBuilder Object and then
> using the StringBuilder ToString() method to get it to regular text. It
> appears to me that when I place a "\n" into the Stringbuilder object that
> when this is translated into text, I loose the page break. Is this true
> and
> I doing something wrong?
> I'm guessing that I could insert a special character into the
> StringBuilder
> object and then use the string Replace() method to translate that special
> character into a "\n" and perhaps this would work.
> Just wondering why it does not work when I place that value into the
> StringBuilder Object.
> Thanks
0 comments:
Post a Comment