Gets the data table of the displayed grid.
[Visual Basic] Public ReadOnly Property CurrentGridTable As DataGridTable [C#] public DataGridTable CurrentGridTable {get;} [C++] public: __property DataGridTable* get_CurrentGridTable(); [JScript] public function get CurrentGridTable() : DataGridTable;
A DataGridTable that represents the current table.
Use the CurrentGridTable property to return a DataGridTable that contains the collection of DataGridColumn objects for the currently displayed table. Other DataGridTable objects are available through the GridTablesCollection, accessed through the GridTables property.
To change values in the DataGrid, use the DataTable returned by the DataGridTable object. The DataTable contains collections of columns and rows that contain the data displayed by the DataGrid.
The following example prints the values of each row in a DataGrid control by accessing the underlying DataTable and its collection of DataRow objects.
[Visual Basic]
Private Sub PrintAllRowValues() Dim dt As DataTable Set dt = DataGrid1.CurrentGridTable.DataTable Dim row As DataRow Dim col As DataColumn For Each row In dt.Rows For Each col in dt.Columns Console.WriteLine(row(col)) Next Next End Sub
DataGrid Class | DataGrid Members | System.WinForms Namespace | DataColumn | DataGridTable | GridTablesCollection | DataTable | DataRow