DataGridTableStyle Constructors

Definition

Initializes a new instance of the DataGridTableStyle class.

Overloads

DataGridTableStyle()

Initializes a new instance of the DataGridTableStyle class.

DataGridTableStyle(Boolean)

Initializes a new instance of the DataGridTableStyle class using the specified value to determine whether the grid table is the default style.

DataGridTableStyle(CurrencyManager)

Initializes a new instance of the DataGridTableStyle class with the specified CurrencyManager.

DataGridTableStyle()

Initializes a new instance of the DataGridTableStyle class.

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

Examples

The following code example creates a new DataGridTableStyle and adds it to the GridTableStylesCollection.

private:
   void AddGridTable()
   {
      DataGridTableStyle^ myGridTableStyle;
      myGridTableStyle = gcnew DataGridTableStyle;
      myGridTableStyle->MappingName = "Customers";
      dataGrid1->TableStyles->Add( myGridTableStyle );
   }
private void AddGridTable(){
   DataGridTableStyle myGridTableStyle;
   myGridTableStyle = new DataGridTableStyle();
   myGridTableStyle.MappingName = "Customers";
   dataGrid1.TableStyles.Add(myGridTableStyle);
}

Private Sub AddGridTable()
   Dim myGridTableStyle As DataGridTableStyle
   myGridTableStyle = New DataGridTableStyle()
   myGridTableStyle.MappingName = "Customers"
   dataGrid1.TableStyles.Add(myGridTableStyle)
End Sub 

DataGridTableStyle(Boolean)

Initializes a new instance of the DataGridTableStyle class using the specified value to determine whether the grid table is the default style.

public:
 DataGridTableStyle(bool isDefaultTableStyle);
public DataGridTableStyle (bool isDefaultTableStyle);
new System.Windows.Forms.DataGridTableStyle : bool -> System.Windows.Forms.DataGridTableStyle
Public Sub New (isDefaultTableStyle As Boolean)

Parameters

isDefaultTableStyle
Boolean

true to specify the table as the default; otherwise, false.

Examples

The following code example creates a new DataGridTableStyle and adds it to the GridTableStylesCollection.

private:
   void AddGridTable()
   {
      DataGridTableStyle^ myGridTableStyle;
      myGridTableStyle = gcnew DataGridTableStyle;
      myGridTableStyle->MappingName = "Customers";
      dataGrid1->TableStyles->Add( myGridTableStyle );
   }
private void AddGridTable(){
   DataGridTableStyle myGridTableStyle;
   myGridTableStyle = new DataGridTableStyle();
   myGridTableStyle.MappingName = "Customers";
   dataGrid1.TableStyles.Add(myGridTableStyle);
}

Private Sub AddGridTable()
   Dim myGridTableStyle As DataGridTableStyle
   myGridTableStyle = New DataGridTableStyle()
   myGridTableStyle.MappingName = "Customers"
   dataGrid1.TableStyles.Add(myGridTableStyle)
End Sub 

DataGridTableStyle(CurrencyManager)

Initializes a new instance of the DataGridTableStyle class with the specified CurrencyManager.

public:
 DataGridTableStyle(System::Windows::Forms::CurrencyManager ^ listManager);
public DataGridTableStyle (System.Windows.Forms.CurrencyManager listManager);
new System.Windows.Forms.DataGridTableStyle : System.Windows.Forms.CurrencyManager -> System.Windows.Forms.DataGridTableStyle
Public Sub New (listManager As CurrencyManager)

Parameters

listManager
CurrencyManager

The CurrencyManager to use.

Examples

The following code example creates a new DataGridTableStyle using a CurrencyManager for a DataTable.

private:
   void CreateDataGridGridTableStyle()
   {
      CurrencyManager^ myCurrencyManager;
      DataGridTableStyle^ myGridTableStyle;
      
      /* Get the CurrencyManager for a DataTable named "Customers"
         found in a DataSet named "myDataSet". */
      myCurrencyManager = dynamic_cast<CurrencyManager^>(BindingContext[myDataSet, "Customers"]);
      myGridTableStyle = gcnew DataGridTableStyle( myCurrencyManager );
      
      // Add the table style to the collection of a DataGrid.
      myDataGrid->TableStyles->Add( myGridTableStyle );
   }

private void CreateDataGridGridTableStyle(){
   CurrencyManager myCurrencyManager;
   DataGridTableStyle myGridTableStyle;
   /* Get the CurrencyManager for a DataTable named "Customers"
   found in a DataSet named "myDataSet". */
   myCurrencyManager = 
   (CurrencyManager) BindingContext[myDataSet, "Customers"];
   myGridTableStyle = new DataGridTableStyle(myCurrencyManager);
   // Add the table style to the collection of a DataGrid.
   myDataGrid.TableStyles.Add(myGridTableStyle);
}
 
Private Sub CreateDataGridGridTableStyle()
   Dim myCurrencyManager As CurrencyManager
   Dim myGridTableStyle As DataGridTableStyle
   ' Get the CurrencyManager for a DataTable named "Customers"
   ' found in a DataSet named "myDataSet". 
   myCurrencyManager = CType _
   (Me.BindingContext(myDataSet, "Customers"), CurrencyManager)
   myGridTableStyle = New DataGridTableStyle(myCurrencyManager)
   ' Add the table style to the collection of a DataGrid.
   myDataGrid.TableStyles.Add(myGridTableStyle)
End Sub

Applies to