GridTableStylesCollection::Add Method (DataGridTableStyle^)
.NET Framework (current version)
Adds a DataGridTableStyle to this collection.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- table
-
Type:
System.Windows.Forms::DataGridTableStyle^
The DataGridTableStyle to add to the collection.
The following code example creates two DataGridTableStyle objects. The example then creates several DataGridColumnStyle objects and adds them to the GridColumnStylesCollection. Finally, the DataGridTableStyle objects are added to the GridTableStylesCollection using the Add method.
void AddDataGridTableStyle() { // Create a new DataGridTableStyle and set MappingName. DataGridTableStyle^ myGridStyle = gcnew DataGridTableStyle; myGridStyle->MappingName = "Customers"; // Create two DataGridColumnStyle objects. DataGridColumnStyle^ colStyle1 = gcnew DataGridTextBoxColumn; colStyle1->MappingName = "firstName"; DataGridColumnStyle^ colStyle2 = gcnew DataGridBoolColumn; colStyle2->MappingName = "Current"; // Add column styles to table style. myGridStyle->GridColumnStyles->Add( colStyle1 ); myGridStyle->GridColumnStyles->Add( colStyle2 ); // Add the grid style to the GridStylesCollection. myDataGrid->TableStyles->Add( myGridStyle ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: