TextBox クラスの新しいインスタンスを初期化します。
名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
'宣言
Public Sub New
'使用
Dim instance As New TextBox
public TextBox ()
public:
TextBox ()
public TextBox ()
public function TextBox ()
解説
親コンテナ コントロールで、TextBox の色およびフォントの設定を定義します。
使用例
TextBox コントロールの新しいインスタンスを作成し、文字列をコントロールの Text プロパティに代入するコード例を次に示します。
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
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:
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.set_Text("Hello World!");
// Code goes here to add the control to the form's control collection.
} //CreateMyTextBoxControl
プラットフォーム
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0
.NET Compact Framework
サポート対象 : 2.0、1.0