I have a UserControl that has a BaseClass object as a public member. Right now I'm doing the following to discern between which type of object I need to instantiate:
Public WithEvents theForm As OrderForm
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Select Case Form
Case OrderItem.ItemsFor.Invoice
theForm = New Invoice(FormID)
Case OrderItem.ItemsFor.PurchaseOrder
theForm = New PurchaseOrder(FormID)
End Select
End Sub
Where both Invoice
and PurchaseOrder
inherit OrderForm
as their base class and FormID
is an integer. I know this is wrong, but I would like to know the correct way to do this.