如何处理一个字段的多个输入实例

时间:2023-02-01 13:00:22

I want to add a line in a multiline textbox after every information that the user enters in the TextBox in Windows form. I wont be able to determine the point to draw line as I wont know how long the user will enter information. So I am thinking of adding a string "_______" after a button click in the code. Is there a better way?

我希望在用户在Windows窗体的TextBox中输入的每个信息之后在多行文本框中添加一行。由于我不知道用户输入信息的时间长短,我无法确定绘制线的点。所以我想在代码中单击按钮后添加一个字符串“_______”。有没有更好的办法?

3 个解决方案

#1


If the user is going to be required to click a button to confirm a single entry then I don't think you should continue to store the information in the same text box & provide a visual separation with a bunch of dashes, rather move the text entered from the input to a more formatted display (set of controls). Then the display will be separated from input. You could them allow the user to select individual input in the display to modify entry providing a nice user experience.

如果要求用户单击按钮以确认单个条目,那么我认为您不应该继续将信息存储在同一文本框中并提供与一串破折号的视觉分离,而是移动文本从输入输入到更格式化的显示(控件集)。然后显示将与输入分开。您可以允许用户在显示中选择单个输入以修改条目,从而提供良好的用户体验。

#2


If you intend to use a regular multiline textbox, printing a line of '-' characters is your best bet. Of course, you could print a line of '─' characters to make the line solid. Another alternative is to use a WebBrowser control, and set its DocumentText property to the HTML you would like to display. This will allow you to append <hr/> whenever you want a dividing line.

如果您打算使用常规的多行文本框,打印一行' - '字符是最好的选择。当然,您可以打印一行“─”字符以使线条变得坚固。另一种方法是使用WebBrowser控件,并将其DocumentText属性设置为您要显示的HTML。这样您就可以在需要分界线时附加


#3


You might consider writing a custom control.

您可以考虑编写自定义控件。

You could either paint the control yourself, or use an autosized label and the control's scollbars.

您可以自己绘制控件,也可以使用自动标签和控件的scollbars。

#1


If the user is going to be required to click a button to confirm a single entry then I don't think you should continue to store the information in the same text box & provide a visual separation with a bunch of dashes, rather move the text entered from the input to a more formatted display (set of controls). Then the display will be separated from input. You could them allow the user to select individual input in the display to modify entry providing a nice user experience.

如果要求用户单击按钮以确认单个条目,那么我认为您不应该继续将信息存储在同一文本框中并提供与一串破折号的视觉分离,而是移动文本从输入输入到更格式化的显示(控件集)。然后显示将与输入分开。您可以允许用户在显示中选择单个输入以修改条目,从而提供良好的用户体验。

#2


If you intend to use a regular multiline textbox, printing a line of '-' characters is your best bet. Of course, you could print a line of '─' characters to make the line solid. Another alternative is to use a WebBrowser control, and set its DocumentText property to the HTML you would like to display. This will allow you to append <hr/> whenever you want a dividing line.

如果您打算使用常规的多行文本框,打印一行' - '字符是最好的选择。当然,您可以打印一行“─”字符以使线条变得坚固。另一种方法是使用WebBrowser控件,并将其DocumentText属性设置为您要显示的HTML。这样您就可以在需要分界线时附加


#3


You might consider writing a custom control.

您可以考虑编写自定义控件。

You could either paint the control yourself, or use an autosized label and the control's scollbars.

您可以自己绘制控件,也可以使用自动标签和控件的scollbars。