Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Campaign should not be blank in the following lines
1 5 6 7
Date in the report should be equal to Report Date selected in Portal in the following lines
1 5 6 7
Agent Id should not be blank in the following lines
1 5 6 7

My question is,
I am using stringbuilder to assign all the error messages. And stringbuilder string is assigned to label control. How i make to display the error messages like above(line by line)?
Posted
Updated 7-Apr-15 3:52am
v2
Comments
ZurdoDev 7-Apr-15 9:47am    
I don't understand what your question is.

Insert a Carriage-Return-Linefeed (CRLF) between each line.

The safest way to do that is to use <a href="https://msdn.microsoft.com/en-us/library/system.environment.newline(v=vs.110).aspx">Environment.NewLine</a>[<a href="https://msdn.microsoft.com/en-us/library/system.environment.newline(v=vs.110).aspx" target="_blank" title="New Window">^</a>] e.g.
C#
var sb = new StringBuilder();
sb.Append("Campaign should not be blank in the following lines");
sb.Append(Environment.NewLine);
sb.Append("1 5 6 7" );
sb.Append(Environment.NewLine);
sb.Append("Date in the report should be equal to Report Date selected in Portal in the following lines");
sb.Append(Environment.NewLine);
sb.Append("1 5 6 7");
sb.Append(Environment.NewLine);
sb.Append("Agent Id should not be blank in the following lines");
sb.Append(Environment.NewLine);
sb.Append("1 5 6 7");
label1.Text = sb.ToString();
 
Share this answer
 
strErrorMessage.AppendLine("\n");
strErrorMessage.AppendLine("Campaign should not be blank in the following lines: ");
strErrorMessage.Append("1 2 3");

I solved in this way.
Thanks to all.....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900