|
C# 2005 For discussion of Visual C# 2005. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
December 7th, 2007, 10:50 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
|
|
new line operator in c#
hello
i want to give new line operator in my coding in c#.
actually my program will send an email to user but i want one message in one line and second in another e.g
strBody = "Your Membership Type is " + MembershipType + "\n";
i put "\n" which is not working i am getting my email in one line only please suggest.
thanks......
__________________
thanks......
|
December 7th, 2007, 11:02 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
Its quite likely that the problem isn't the C# code, but the email itself.
It might be that the email program required both a carriage return and a line feed to show a new line, e.g. "\r\n".
/- Sam Judson : Wrox Technical Editor -/
|
December 7th, 2007, 11:17 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
You can also employ System.Environment.NewLine
hth.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
|
December 7th, 2007, 01:26 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
What format is the email in? Plain text or HTML?
-Peter
|
December 7th, 2007, 02:12 PM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
|
|
well i will apply above two options and let know.
My email format is Plain Text.
thanks......
|
December 8th, 2007, 04:07 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
|
|
please solve my problem.
i tried both solution
1) i put "\r\n"
strBody = "Your Membership Type is " + MembershipType + "\r\n";
2) use of System.Environment.NewLine
strBody = "Your Membership Type is " + MembershipType + System.Environment.NewLine;
Both are not working.
Please suggest.
thanks......
|
December 8th, 2007, 06:54 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
I'm assuming there is more to the strBody that just that one line?
i.e.
strBody += "The next line...";
/- Sam Judson : Wrox Technical Editor -/
|
December 8th, 2007, 08:03 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
|
|
yes there are so many lines in body of message, you are right but still i am not getting.
thanks......
|
December 8th, 2007, 09:29 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Let's focus on the receiving end of the message. How are you looking at the message? What mail reader? Is it possible that the problem isn't that the newline characters aren't there, but rather that your mail reader is ignoring them. Can you look at the raw source of the message to confirm that the newline characters are now there?
-Peter
|
December 11th, 2007, 03:03 AM
|
Friend of Wrox
|
|
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Well planoie,
you were absolutely write, my mail reader was ignoring them when i use my other email id's, it works perfectely.
Thanks for all for solution.
thanks......
|
|
|