Solution:
To display the escape character for '\t', I made use of the replace function.
private void button_Click(object sender, EventArgs e)
{
string s = "\tDenis\t";
s = s.Replace("\t", " ");
label1.Text = s.ToString();
}
C#, HTML, XHTML, CSS, Javascript, Project Management
private void button_Click(object sender, EventArgs e)
{
string s = "\tDenis\t";
s = s.Replace("\t", " ");
label1.Text = s.ToString();
}
Hi, I found another way.
ReplyDelete-----------------------------------------------
Firstly, change some properties of the label in properties window.
Autosize : True ---> False
FlatStyle : Standard --->System
Next, write a code for display.
myLabel.Text = "a\tb\naa\tb";
-----------------------------------------------
Actually, I don't know exactly what FlatStyle is...I have to check later.I refered to these pages:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/7ba39df1-1819-489d-b821-708cb7024b0c/
http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/37d6f140-d708-4c49-b4e5-dd4cdeddee3f/
Wonderful! It works. Thanks Misa :)
ReplyDeleteHey Misa,
ReplyDeleteI was doing some research on textboxes in C#. Do you know how to display new lines in textboxes with multiple lines, given that their fixedsize is set to false?
I cannot the \t and \n to work.
However, \t and \n works fine with the RichTextEditor...