DataGridTextBoxColumn クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridTextBoxColumn クラスの意味・解説 

DataGridTextBoxColumn クラス

文字列編集使用する、DataGridColumnStyle のセル内の TextBox コントロールホストます。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Class DataGridTextBoxColumn
    Inherits DataGridColumnStyle
Dim instance As DataGridTextBoxColumn
public class DataGridTextBoxColumn : DataGridColumnStyle
public ref class DataGridTextBoxColumn : public
 DataGridColumnStyle
public class DataGridTextBoxColumn extends
 DataGridColumnStyle
public class DataGridTextBoxColumn extends
 DataGridColumnStyle
解説解説

DataGridTextBoxColumn クラスは、abstract クラスDataGridColumnStyle から派生したものです。実行時に、DataGridTextBoxColumn は、ユーザーテキスト編集のために使用できる DataGridTextBox コントロールホストます。

このクラスには、Format および HideEditBox などの特殊なプロパティ追加されています。これらのプロパティ使用すると、ホスト対象DataGridTextBox コントロールとその属性アクセスし、値を表示するときに適用する書式設定できます

データ ソースが DataColumn オブジェクト格納している DataTable である場合は、DataColumnDataType プロパティに、テキスト ボックス コントロール論理的に編集できるデータ型設定する必要がありますDataGridTextBoxColumn自動的に関連付けられるデータ型は、ByteDateTimeDecimalDouble、Int16、Int32、Int64、UInt16、UInt32、UInt64、Single、および String です。

メモメモ

DateTimeUInt16UInt32UInt64、TimeSpan の各データ型は、Visual Basic では完全にはサポートされていません。また、演算子使用できません。

使用例使用例

DataGridTextBoxColumn作成し、GridColumnStylesCollection に追加する例を次に示します。このコード例実行するには、アセンブリの完全限定名を指定する必要がありますアセンブリの完全限定名を取得する方法については、「アセンブリ名」を参照してください

Private Sub AddColumn()
    Dim myTable As New DataTable()
    
    ' Add a new DataColumn to the DataTable.
    Dim myColumn As New
 DataColumn("myTextBoxColumn")
    myColumn.DataType = System.Type.GetType("System.String")
    myColumn.DefaultValue = "default string"
    myTable.Columns.Add(myColumn)
    ' Get the CurrencyManager for the DataTable.
    Dim cm As CurrencyManager = CType(Me.BindingContext(myTable),
 CurrencyManager)
    ' Use the CurrencyManager to get the PropertyDescriptor for the
 new column.
    Dim pd As PropertyDescriptor = cm.GetItemProperties()("myTextBoxColumn")
    Dim myColumnTextColumn As DataGridTextBoxColumn
    ' Create the DataGridTextBoxColumn with the PropertyDescriptor.
    myColumnTextColumn = New DataGridTextBoxColumn(pd)
    ' Add the new DataGridColumn to the GridColumnsCollection.
    dataGrid1.DataSource = myTable
    dataGrid1.TableStyles.Add(New DataGridTableStyle())
    dataGrid1.TableStyles(0).GridColumnStyles.Add(myColumnTextColumn)
End Sub 'AddColumn
private void AddColumn()
{
     DataTable myTable= new DataTable();
 
     // Add a new DataColumn to the DataTable.
     DataColumn myColumn = new DataColumn("myTextBoxColumn");
     myColumn.DataType = System.Type.GetType("System.String");
     myColumn.DefaultValue="default string";
     myTable.Columns.Add(myColumn);
     // Get the CurrencyManager for the DataTable.
     CurrencyManager cm = (CurrencyManager)this.BindingContext[myTable];
     // Use the CurrencyManager to get the PropertyDescriptor for the
 new column.
     PropertyDescriptor pd = cm.GetItemProperties()["myTextBoxColumn"];
     DataGridTextBoxColumn myColumnTextColumn;
     // Create the DataGridTextBoxColumn with the PropertyDescriptor.
     myColumnTextColumn = new DataGridTextBoxColumn(pd);
     // Add the new DataGridColumn to the GridColumnsCollection.
     dataGrid1.DataSource= myTable;
     dataGrid1.TableStyles.Add(new DataGridTableStyle());
     dataGrid1.TableStyles[0].GridColumnStyles.Add(myColumnTextColumn);
 }

private:
   void AddColumn()
   {
      DataTable^ myTable = gcnew DataTable;
      
      // Add a new DataColumn to the DataTable.
      DataColumn^ myColumn = gcnew DataColumn( "myTextBoxColumn" );
      myColumn->DataType = System::Type::GetType( "System::String" );
      myColumn->DefaultValue = "default string";
      myTable->Columns->Add( myColumn );
      
      // Get the CurrencyManager for the DataTable.
      CurrencyManager^ cm = dynamic_cast<CurrencyManager^>(this->BindingContext[
 myTable ]);
      
      // Use the CurrencyManager to get the PropertyDescriptor for the
 new column.
      System::ComponentModel::PropertyDescriptor^ pd = cm->GetItemProperties()[
 "myTextBoxColumn" ];
      DataGridTextBoxColumn^ myColumnTextColumn;
      
      // Create the DataGridTextBoxColumn with the PropertyDescriptor.
      myColumnTextColumn = gcnew DataGridTextBoxColumn( pd );
      
      // Add the new DataGridColumn to the GridColumnsCollection.
      dataGrid1->DataSource = myTable;
      dataGrid1->TableStyles->Add( gcnew DataGridTableStyle );
      dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumnTextColumn
 );
   }

private void AddColumn()
{
    DataTable myTable = new DataTable();
    // Add a new DataColumn to the DataTable.
    DataColumn myColumn = new DataColumn("myTextBoxColumn");
    myColumn.set_DataType(System.Type.GetType("System.String"));
    myColumn.set_DefaultValue("default string");
    myTable.get_Columns().Add(myColumn);
    // Get the CurrencyManager for the DataTable.
    CurrencyManager cm = (CurrencyManager)(this.get_BindingContext().
        get_Item(myTable));
    // Use the CurrencyManager to get the PropertyDescriptor 
    // for the new column.
    PropertyDescriptor pd = cm.GetItemProperties().
        get_Item("myTextBoxColumn");
    DataGridTextBoxColumn myColumnTextColumn;

    // Create the DataGridTextBoxColumn with the PropertyDescriptor.
    myColumnTextColumn = new DataGridTextBoxColumn(pd);

    // Add the new DataGridColumn to the GridColumnsCollection.
    dataGrid1.set_DataSource(myTable);
    dataGrid1.get_TableStyles().Add(new DataGridTableStyle());
    dataGrid1.get_TableStyles().get_Item(0).
        get_GridColumnStyles().Add(myColumnTextColumn);
} //AddColumn
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.DataGridColumnStyle
        System.Windows.Forms.DataGridTextBoxColumn
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridTextBoxColumn メンバ
System.Windows.Forms 名前空間
DataGridBoolColumn クラス
DataGridColumnStyle クラス
DataColumn
DataType
DataGrid クラス
DataGridTextBox クラス
TextBox



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridTextBoxColumn クラス」の関連用語

DataGridTextBoxColumn クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridTextBoxColumn クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS