Gets or sets all of the tables in this collection.
[Visual Basic] Public Property All As DataTable () [C#] public DataTable[] All {get; set;} [C++] public: __property DataTable* get_All(); public: __property void set_All(DataTable*[]); [JScript] public function get All() : DataTable[]; public function set All(DataTable[]);
An array of DataTable objects.
The All method throws an exception if any table that is added shouldn't be added and if any table is removed shouldn't be removed. If an exception is thrown, the collection returns to its original state.
The OnCollectionChanged event occurs if setting the property to a new values succeeds.
The following example returns an array of DataTable objects for a DataSet.
[Visual Basic]
Private Sub GetAllTables() Dim tableCol As TablesCollection Dim dSet As DataSet ' Presuming a DataGrid is displaying more than one table, get its DataSet. Set dSet = DataGrid1.DataGridTable.DataTable.DataSet ' Get the TablesCollection variable. Set tableCol = dSet.Tables ' Declare an array for DataTable objects. Dim tables() As DataTable ' Set the array using the All method. Set tables = tableCol.All Dim i As Integer For i = 0 To UBound(tables) Console.WriteLine(tables(i).TableName) Next End Sub
TablesCollection Class | TablesCollection Members | System.Data Namespace | Tables | DataTable | Add | Remove