DataGridTableStyle.DataGrid Property

Definition

Gets or sets the DataGrid control for the drawn table.

C#
[System.ComponentModel.Browsable(false)]
public virtual System.Windows.Forms.DataGrid DataGrid { get; set; }

Property Value

The DataGrid control that displays the table.

Attributes

Examples

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

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

Remarks

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.

Applies to

Product Versions
.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