locked
RichTextBox1.Text 和 TextBox1.Text 有什么不同。 RRS feed

  • 问题

  • 正在我只是知道有一个不同。 RichTextBox1.Text 用的是 vbLf (换行符); TextBox1.Text 用的是 vbCrLf (回车换行符)。
    2016年8月31日 12:22

答案

  • 参考下下面两个连接,我认为主要是数据绑定的区别,TextBox支持data binding, RichTextBox不支持。

    http://www.codeproject.com/Questions/190989/Difference-between-textbox-and-richtextbox

    Here are Some Difference Between Textbox and RichTextBox :
    ==========================================================

    A RichTextBox is a better choice when it is necessary for the user to edit formatted text, images, tables, or other rich content. For example, editing a document, article, or blog that requires formatting, images, etc is best accomplished using a RichTextBox.

    A TextBox requires less system resources then a RichTextBox and it is ideal when only plain text needs to be edited (i.e. usage in forms).

    A RichTextBox mainly used if you want more control over styling the text color, type, font, alignment ect. So anything you can do in Microsoft Word, you can do with a RichTextBox. It can be used to save or display .rtf files with ease.

    A Textbox is basically used to display or get one line input. You can have a multi-line TextBox which is used mainly to display or get more than one one-liner and keeps you from having to manage multiple TextBox's. Also keeps your UI a little more tidy.

    An important technical difference is that TextBox supports DataBinding, RichTextBox does not, which makes it a bit nasty to use in an MVVM application.

    The text box displays plain ASCII or Unicode text.

    The Rich Text Box displays Rich Text Format text - which allows many of the formatting possibilities supported by word processors - different typefaces, tables, etc. This is useful if it can be treated opaquely, but you rarely want to be doing textual manipulation of Rich Text, as its horrible.

    On the other hand, many tools such as programmers editors use the RichTextBox, as it allows the developer to support options like syntax colouring.

    https://social.msdn.microsoft.com/Forums/windows/en-US/a06ab05a-fbde-47ef-89c5-a7a57f32ffd3/whats-the-difference-between-rich-text-boxes-and-normal-text-boxes?forum=winforms


    专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

    2016年8月31日 12:51

全部回复

  • 参考下下面两个连接,我认为主要是数据绑定的区别,TextBox支持data binding, RichTextBox不支持。

    http://www.codeproject.com/Questions/190989/Difference-between-textbox-and-richtextbox

    Here are Some Difference Between Textbox and RichTextBox :
    ==========================================================

    A RichTextBox is a better choice when it is necessary for the user to edit formatted text, images, tables, or other rich content. For example, editing a document, article, or blog that requires formatting, images, etc is best accomplished using a RichTextBox.

    A TextBox requires less system resources then a RichTextBox and it is ideal when only plain text needs to be edited (i.e. usage in forms).

    A RichTextBox mainly used if you want more control over styling the text color, type, font, alignment ect. So anything you can do in Microsoft Word, you can do with a RichTextBox. It can be used to save or display .rtf files with ease.

    A Textbox is basically used to display or get one line input. You can have a multi-line TextBox which is used mainly to display or get more than one one-liner and keeps you from having to manage multiple TextBox's. Also keeps your UI a little more tidy.

    An important technical difference is that TextBox supports DataBinding, RichTextBox does not, which makes it a bit nasty to use in an MVVM application.

    The text box displays plain ASCII or Unicode text.

    The Rich Text Box displays Rich Text Format text - which allows many of the formatting possibilities supported by word processors - different typefaces, tables, etc. This is useful if it can be treated opaquely, but you rarely want to be doing textual manipulation of Rich Text, as its horrible.

    On the other hand, many tools such as programmers editors use the RichTextBox, as it allows the developer to support options like syntax colouring.

    https://social.msdn.microsoft.com/Forums/windows/en-US/a06ab05a-fbde-47ef-89c5-a7a57f32ffd3/whats-the-difference-between-rich-text-boxes-and-normal-text-boxes?forum=winforms


    专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

    2016年8月31日 12:51
  • Rich text box可以显示RTF文件即带格式文本。
    2016年9月15日 6:20