Denaes Posted June 28, 2006 Posted June 28, 2006 Okay, Datasource is an Object, which allows it to handle multiple types of DataSources. I'm having a user pass one in, I was "DirectCast"ing it to a DataSet, which is what I need, which worked fine if I choose A Dataset or TypedDataSet as the Datasource. If I choose a BindingSource, it errors out here. Obviously you can't DirectCast a BindingSource into a DataSet. But because things are Typed, I can't see how to make any logical statements to handle the DirectCasting. If I getType, it returns the TypedClass (ie CustomerDataSet rather than DataSet; or CustomerBindingSource rather than BindingSource). Is there any way to get to that base class? I need to be able to tell "Is this a Dataset?" "Is this a BindingSource?" so I can handle that DirectCast and the different methods to get into a specified tables data. Quote
Denaes Posted June 28, 2006 Author Posted June 28, 2006 Shoulda asked a while ago. Always seems I find an answer like 5 minutes after I ask on a forum. If TypeOf (m_BindingSource.DataSource) Is DataSet Then Dim ds As DataSet = DirectCast(m_BindingSource.DataSource, DataSet) PopulateDataTable(ds) End If Well the If...Then statement is the answer to the problem, but I figured I'd throw that out there in case this helps anyone else :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.