G
Guest
i have a generic class
Public Class ACollection(Of T)
Inherits BindingList(Of T)
where BaseDataClass is declared mustinherit
i then have some code that loadss the collection
With oSQLDR ' a datareader
If .HasRows Then
Do While .Read = True
'Create new instance of appropriate businees object
then populate
Dim o As Object = Me.AddNew
busObject = CType(o, IDataClass)
busObject.clientConnection = Me.ClientConnection
busObject.Populate(oSQLDR)
Loop
End If
End With
this all works fine
however if i change this collection to
Public Class ACollection(Of BaseCLass)
how, when using AddNew in the above code do i get addnew to add the correct
type of object (which inherits from BaseClass)
guyy
Public Class ACollection(Of T)
Inherits BindingList(Of T)
where BaseDataClass is declared mustinherit
i then have some code that loadss the collection
With oSQLDR ' a datareader
If .HasRows Then
Do While .Read = True
'Create new instance of appropriate businees object
then populate
Dim o As Object = Me.AddNew
busObject = CType(o, IDataClass)
busObject.clientConnection = Me.ClientConnection
busObject.Populate(oSQLDR)
Loop
End If
End With
this all works fine
however if i change this collection to
Public Class ACollection(Of BaseCLass)
how, when using AddNew in the above code do i get addnew to add the correct
type of object (which inherits from BaseClass)
guyy