best way to show some text in textbox in Window application
i need to write a list of url in a textbox in a window apps but when i write it he was mixed like http://google.comhttp://google.comhttp://google.comi
but i want to show clearly i alrea开发者_如何转开发dy used
"\n\r" method but he not worked are any sollution for itTry to use "\n\r" for line break.
yes First you need to set the multiline
property to True
and better to use Environment.NewLine
to set the new line.
Or in stringBuilber.AppedLine("")
Hope this will helpo you :)
You need set the multiline property of your Textbox
to true. Then use Environment.NewLine to do a cr/lf (this is equivalent to /r/n)
http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.aspx
You will need to use a multiline textbox for this. Place Environment.NewLine after each url and it should work.
BTW why are you not using ListBox or ListView?
When working with string or such, try using StringBuilder, it works in my app.
private void FillTextBox()
{
StringBuilder st = new StringBuilder();
st.AppendLine("http://www.google.be");
st.AppendLine("http://www.google.be");
st.AppendLine("http://www.google.be");
st.AppendLine("http://www.google.be");
st.AppendLine("http://www.google.be");
st.AppendLine("http://www.google.be");
st.AppendLine("http://www.google.be");
textBox1.Text = st.ToString();
}
精彩评论