Files
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

3.1 KiB

title, ms.date, dev_langs, f1_keywords, helpviewer_keywords, ms.assetid
title ms.date dev_langs f1_keywords helpviewer_keywords ms.assetid
TextBox Control Overview 03/30/2017
csharp
vb
cpp
TextBox
TextBox control [Windows Forms], about TextBox controls
text boxes [Windows Forms], adding
d1a9c7f5-fa53-480a-a75c-158f8649ea2f

TextBox Control Overview (Windows Forms)

Windows Forms text boxes are used to get input from the user or to display text. The xref:System.Windows.Forms.TextBox control is generally used for editable text, although it can also be made read-only. Text boxes can display multiple lines, wrap text to the size of the control, and add basic formatting. The xref:System.Windows.Forms.TextBox control provides a single format style for text displayed or entered into the control. To display multiple types of formatted text, use the xref:System.Windows.Forms.RichTextBox control. For more information, see RichTextBox Control Overview.

Working with the TextBox Control

The text displayed by the control is contained in the xref:System.Windows.Forms.TextBox.Text%2A property. By default, you can enter up to 2048 characters in a text box. If you set the xref:System.Windows.Forms.TextBox.Multiline%2A property to true, you can enter up to 32 KB of text. The xref:System.Windows.Forms.TextBox.Text%2A property can be set at design time with the Properties Window, at run time in code, or by user input at run time. The current contents of a text box can be retrieved at run time by reading the xref:System.Windows.Forms.TextBox.Text%2A property.

The following code example sets text in the control at run time. The InitializeMyControl procedure will not execute automatically; it must be called.

Private Sub InitializeMyControl()  
   ' Put some text into the control first.  
   TextBox1.Text = "This is a TextBox control."  
End Sub  
private void InitializeMyControl() {  
   // Put some text into the control first.  
   textBox1.Text = "This is a TextBox control.";  
}  
private:  
   void InitializeMyControl()  
   {  
      // Put some text into the control first.  
      textBox1->Text = "This is a TextBox control.";  
   }  

See also