Edit

Share via


DataGridTableStyle.DataGrid Property

Definition

Gets or sets the DataGrid control for the drawn table.

public:
 virtual property System::Windows::Forms::DataGrid ^ DataGrid { System::Windows::Forms::DataGrid ^ get(); void set(System::Windows::Forms::DataGrid ^ value); };
[System.ComponentModel.Browsable(false)]
public virtual System.Windows.Forms.DataGrid DataGrid { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.DataGrid : System.Windows.Forms.DataGrid with get, set
Public Overridable Property DataGrid As DataGrid

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.

private:
   void GetSelectedIndex( DataGridTableStyle^ myGridTable )
   {
      /* Get the name of the DataGrid of the DataGridTable 
         passed as an argument. */
      Console::WriteLine( myGridTable->DataGrid->CurrentCell.ToString() );
   }
private void GetSelectedIndex(DataGridTableStyle myGridTable)
{
   /* Get the name of the DataGrid of the DataGridTable 
      passed as an argument. */
   Console.WriteLine(myGridTable.DataGrid.CurrentCell.ToString());
}
Private Sub GetSelectedIndex(myGridTable As DataGridTableStyle)
    ' Get the name of the DataGrid of the DataGridTable 
    ' passed as an argument. 
    Console.WriteLine(myGridTable.DataGrid.CurrentCell.ToString())
End Sub

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