0

我需要在窗口应用程序的文本框中写一个 url 列表,但是当我写它时,他就像http://google.comhttp://google.comhttp://google.comi一样混合

但我想清楚地表明我已经使用了
“\n\r”方法但他没有工作是任何解决方案

4

5 回答 5

1

尝试使用 "\n\r" 换行。

于 2010-04-26T07:33:08.523 回答
0

您需要将您的多行属性设置Textbox为 true。然后用Environment.NewLine做一个cr/lf(这个相当于/r/n)

http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.aspx

于 2010-04-26T07:36:10.613 回答
0

为此,您将需要使用多行文本框。将 Environment.NewLine 放在每个 url 之后,它应该可以工作。

顺便说一句,您为什么不使用 ListBox 或 ListView?

于 2010-04-26T07:38:02.097 回答
0

使用字符串等时,请尝试使用 StringBuilder,它适用于我的应用程序。

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();
    }
于 2010-04-26T07:38:57.053 回答
0

是的,首先您需要将multiline属性设置为True并更好地用于Environment.NewLine设置新行。

或在stringBuilber.AppedLine("")

希望这会对你有所帮助:)

于 2010-04-26T07:39:40.013 回答