Textbox with “new line”

前端 未结 2 1110
难免孤独
难免孤独 2021-01-12 06:04

We tried several ways to make a textbox to accept the \"enter\", newline, etc.. But we are still facing the same problems. Most of the \"Third party\" controls allow the use

2条回答
  •  一个人的身影
    2021-01-12 06:20

    Set the mode to TextBoxMode.MultiLine

    Either in the code-behind,

    myTextBox.TextMode = TextBoxMode.MultiLine
    

    or in the markup

    When the user enters text in the TextBox, it will come back to you with new lines as \r\n. If you'd like to display it properly to the user, you could use

    myTextBox.Text.Replace(Environment.NewLine, "
    ")

提交回复
热议问题