Export (0) Print
Expand All

DataGridTableStyle.DataGrid Property

Gets or sets the System.Windows.Forms.DataGrid control for the drawn table.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[BrowsableAttribute(false)]
public virtual DataGrid DataGrid { get; set; }

Property Value

Type: System.Windows.Forms.DataGrid
The System.Windows.Forms.DataGrid control that displays the table.

The System.Windows.Forms.DataGrid control displays data in the form of a grid. The DataGridTableStyle is an object that represents the drawn grid. The System.Windows.Forms.DataGrid property returns a reference to the control that is displaying the grid.

The DataGrid property is set when a DataGridTableStyle is added to a System.Windows.Forms.DataGrid control's GridTableStylesCollection. You should not try to set this property unless you are overriding it and creating a designer for a user control that incorporates the DataGrid control.

The following code example prints the CurrentCell of the System.Windows.Forms.DataGrid displaying a DataGridTableStyle.

private void GetSelectedIndex(DataGridTableStyle myGridTable)
{
   /* Get the name of the DataGrid of the DataGridTable 
      passed as an argument. */
   Console.WriteLine(myGridTable.DataGrid.CurrentCell.ToString());
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft