Using Different code than before
Public Sub MySub()
Dim DS As New DataSet
Dim Table As New DataTable("MyTable")
DS.Tables.Add(Table)
DS.AcceptChanges()
Dim myTable As DataTable
myTable = DS.Tables("asdsafsdag"
End Sub
This doesn't raise an error even though the table asdsafsdag doesn't exist in the dataset.
Help
_____________________________
BeforeEdit:
Dataset has 3 tables Table1, Table2, Table3
ReturnTable("hjgghfhdhjh")
________________________________________________
Public Function ReturnTable (DataTableName as String) as DataTable
Try
Return DataSet.Tables(DataTableName)
Catch
msgbox(err.description)
End Try
End Function
___________________________________________________
Help

Using nonexistant tablename doen't raise error
Markchr
According to the docs..an empty table is returned if no table exist:
Public ReadOnly Property Tables() As System.Data.DataTableCollectionMember of: System.Data.DataSet
Summary:
Gets the collection of tables contained in the System.Data.DataSet.
Return Values:
The System.Data.DataTableCollection contained by this System.Data.DataSet. An empty collection is returned if no System.Data.DataTable objects exist.
Accordingly...no error should be throw
Urue
PlusOne