DataGrid Property

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
Available since 1.1
Return to top
Show:
© 2016 Microsoft