Adds a table to the collection.
Creates a new table with a default name and adds it to the collection.
[Visual Basic] Overloads Overridable Public Function Add() As DataTable
[C#] public virtual DataTable Add();
[C++] public: virtual DataTable* Add();
[JScript] public function Add() : DataTable;
Creates a table with the given name and adds it to the collection.
[Visual Basic] Overloads Overridable Public Function Add(String) As DataTable
[C#] public virtual DataTable Add(String);
[C++] public: virtual DataTable* Add(String*);
[JScript] public function Add(String) : DataTable;
Adds the specified table to the collection.
[Visual Basic] Overloads Overridable Public Sub Add(DataTable)
[C#] public virtual void Add(DataTable);
[C++] public: virtual void Add(DataTable*);
[JScript] public function Add(DataTable);
The following example creates a DataTable and adds it to the TablesCollection of a DataSet.
Note This example shows how to use one of the overloaded versions of Add. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Private Sub AddDataTable() Dim tablesCol As TablesCollection ' Get the TablesCollection of a DataGrid control's DataSet. Set tabelesCol = DataGrid1.DataGridTable.DataTable.DataSet.Tables ' Create a new DataTable. Dim myTable As DataTable = New DataTable ' Code to add columns and rows not shown here. ' Add the table to the TablesCollection. tablesCol.Add myTable End Sub
TablesCollection Class | TablesCollection Members | System.Data Namespace