C# – How to add text in a multiline textbox

c++

I have to add details of my file into a multiline textbox. But all the details are getting added in a single line in the text box and not in a vertical sequence. I used Environment.NewLine and also used "\r\n", but it's not of any help. I have ticked the multiline text box in a Windows Forms form and also set it to true but to no avail.

My line of code is like this:

m_Txt.Multiline = true;

m_Txt.Text = fileInfo.m_Title + "\r\n" + 
             fileInfo.m_Identifier + Environment.NewLine + 
             fileInfo.m_TotalTime;

Best Solution

A cleaner answer is:

Assuming txtStatus is a textbox:

txtStatus.Multiline = True;
txtStatus.Clear();
txtStatus.Text += "Line 1" + Environment.NewLine;
txtStatus.Text += "Line 2" + Environment.NewLine;

Using the built in enumeration means cleaner code.