Reputation: 2861
this is probably an easy one, I just dont know what it is! Im trying to add the contents of a field from a query to the 1st line of an email in c#, then have a new line for the rest of the body.
nmail.Body = i.bDesc + MsgBody.Text;
So Id want to put the carriage return between i.bDesc and MsgBody.Text, Can anyone give me a nudge in the right direction?
thanks
Upvotes: 0
Views: 93
Reputation: 8572
This should work.
nmail.Body = i.bDesc + "\r\n" + MsgBody.Text;
Or...
nmail.Body = String.Format("{0}\r\n{1}",i.bDesc,MsgBody.Text);
Upvotes: 0
Reputation: 21630
You can use \r\n
for a new line, which is the equivalent of VbCrLf in vb.net. Aducci has given a good cross-language answer.
Upvotes: 0
Reputation: 26694
nmail.Body = i.bDesc + System.Environment.NewLine + MsgBody.Text ;
Upvotes: 6