G
Guest
I have designed a user control (UserControl0) from which several other user
controls (ChildUserControl(n)) inherit. Each ChildUserControl(n) has its own
strongly typed dataset. I would like to include several (overridable)
methods in UserControl(0) that act on the datasets (nothing exotic, only
things that can be executed against an untyped dataset). Occasionally, I
will want to override these methods and exploit the strong typing. What is
the best way to go about this?
I think I want to do something like this:
Class UserControl0
Private mds as Dataset
Private mMyString as String
Protected Property DS as Dataset
Get
return mds
End Get
Set (value as Dataset)
mds=value
End Set
End Property
Protected Overridable Sub MyExample
mMyString=mds.Tables(0).TableName
End Sub
..
..
..
..
End Class
Class ChildUserControl
Inherits UserControl0
Private mds as MyStronglyTypedDataset
Private mMyValue as Object
Public Shadows Property DS as MyStronglyTypedDataset
Get
Return CType(MyBase.DS,MyStronglyTypedDataset)
End Get
Set (Value as MyStronglyTypedDataset)
MyBase.DS=CType(Value,Dataset)
End Set
End Property
Protected Overrides Sub MyExample
MyBase.MyExample
mMyValue=mds.MyTable.MyColumn
End Sub
..
..
..
..
End Class
Of course, this won't work because CType doesn't work between Dataset as
MyStronglyTypedDataset. But I think you can get the idea of what I am trying
to accomplish.
Thanks for the help,
controls (ChildUserControl(n)) inherit. Each ChildUserControl(n) has its own
strongly typed dataset. I would like to include several (overridable)
methods in UserControl(0) that act on the datasets (nothing exotic, only
things that can be executed against an untyped dataset). Occasionally, I
will want to override these methods and exploit the strong typing. What is
the best way to go about this?
I think I want to do something like this:
Class UserControl0
Private mds as Dataset
Private mMyString as String
Protected Property DS as Dataset
Get
return mds
End Get
Set (value as Dataset)
mds=value
End Set
End Property
Protected Overridable Sub MyExample
mMyString=mds.Tables(0).TableName
End Sub
..
..
..
..
End Class
Class ChildUserControl
Inherits UserControl0
Private mds as MyStronglyTypedDataset
Private mMyValue as Object
Public Shadows Property DS as MyStronglyTypedDataset
Get
Return CType(MyBase.DS,MyStronglyTypedDataset)
End Get
Set (Value as MyStronglyTypedDataset)
MyBase.DS=CType(Value,Dataset)
End Set
End Property
Protected Overrides Sub MyExample
MyBase.MyExample
mMyValue=mds.MyTable.MyColumn
End Sub
..
..
..
..
End Class
Of course, this won't work because CType doesn't work between Dataset as
MyStronglyTypedDataset. But I think you can get the idea of what I am trying
to accomplish.
Thanks for the help,