TextBox 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 TextBox 類別的新執行個體。
public:
TextBox();
public TextBox ();
Public Sub New ()
範例
下列程式碼範例會建立 控制項的新實例 TextBox ,並將字串指派給控制項的 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
備註
父容器控制項會定義 的 TextBox 色彩和字型設定。