TextBox Konstruktor

Definice

Inicializuje novou instanci TextBox třídy.

public:
 TextBox();
public TextBox ();
Public Sub New ()

Příklady

Následující příklad kódu vytvoří novou instanci TextBox ovládacího prvku a přiřadí řetězec vlastnosti ovládacího prvku Text .

public:
   void CreateMyTextBoxControl()
   {
      // Create a new TextBox control using this constructor.
      TextBox^ textBox1 = gcnew TextBox;
      // Assign a string of text to the new TextBox control.
      textBox1->Text = "Hello World!";
      // Code goes here to add the control to the form's control collection.
   }
public void CreateMyTextBoxControl()
 {
    // Create a new TextBox control using this constructor.
    TextBox textBox1 = new TextBox();
    // Assign a string of text to the new TextBox control.
    textBox1.Text = "Hello World!";
    // Code goes here to add the control to the form's control collection.
 }
Public Sub CreateMyTextBoxControl()
    ' Create a new TextBox control using this constructor.
    Dim textBox1 As New TextBox()
    ' Assign a string of text to the new TextBox control.
    textBox1.Text = "Hello World!"

    ' Code goes here to add the control to the form's control collection.
End Sub

Poznámky

Nadřazený ovládací prvek kontejneru definuje nastavení barvy a písma pro objekt TextBox.

Platí pro