GridTableStylesCollection.Item[] Property

Definition

Gets the specified DataGridTableStyle.

Overloads

Item[Int32]

Gets the DataGridTableStyle specified by index.

Item[String]

Gets the DataGridTableStyle with the specified name.

Item[Int32]

Gets the DataGridTableStyle specified by index.

C#
public System.Windows.Forms.DataGridTableStyle this[int index] { get; }

Parameters

index
Int32

The index of the DataGridTableStyle to get.

Property Value

The DataGridTableStyle at the specified index.

Exceptions

No item exists at the specified index.

Examples

The following code example returns a DataGridTableStyle from the GridTableStylesCollection by passing an index to the Item[] property.

C#
private void GetGridTableByIndex()
{
   DataGridTableStyle myGridStyle = 
   myDataGrid.TableStyles[0] ;
   Console.WriteLine(myGridStyle.MappingName);
}

Remarks

Use the Add or AddRange method to add items to the collection.

Applies to

.NET Framework 4.8.1 i druge verzije
Proizvod Verzije
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 10

Item[String]

Gets the DataGridTableStyle with the specified name.

C#
public System.Windows.Forms.DataGridTableStyle this[string tableName] { get; }

Parameters

tableName
String

The MappingName of the DataGridTableStyle to retrieve.

Property Value

The DataGridTableStyle with the specified MappingName.

Examples

The following code example returns a DataGridTableStyle from the GridTableStylesCollection by passing the MappingName to the Item[] property.

C#
private void GetGridTableByName()
{
   DataGridTableStyle myGridStyle = 
   myDataGrid.TableStyles["customers"] ;
   Console.WriteLine(myGridStyle.MappingName);
}

Remarks

When retrieving a DataGridTableStyle by MappingName, the Item[] property uses a case-insensitive comparison.

Use the Add or AddRange method to add items to the collection.

Applies to

.NET Framework 4.8.1 i druge verzije
Proizvod Verzije
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 10