B
Brian
I have many similar classes in a project, one for each type of report
my app can create. I want to instantiate them based on a value passed
in by a scheduler module.
Right now I have
Sub RunReports(sReport)
Select Case sReport
Case "CRByDistrict"
oReport = New CRByDistrict
Case "CRCareConversionRate"
oReport = New CRCareConversionRate
Case (etc.....)
End Select
oReport.Build ' All classes implement a Build method
End Sub
For example, if the scheduler says it's time to run the "CRByDistrict"
report I want to pass in "CRByDistrict" and invoke
oReport = New <className> ' One line handles all reports
where in this case <className> is "CRByDistrict". I've looked at
Activator.CreateInstance and some other things, but I can't figure out
the best, simplest way to do this.
I'm tired of maintaining what has become a huge Select Case statement
each time I add a new report (class).
Thanks,
Brian
my app can create. I want to instantiate them based on a value passed
in by a scheduler module.
Right now I have
Sub RunReports(sReport)
Select Case sReport
Case "CRByDistrict"
oReport = New CRByDistrict
Case "CRCareConversionRate"
oReport = New CRCareConversionRate
Case (etc.....)
End Select
oReport.Build ' All classes implement a Build method
End Sub
For example, if the scheduler says it's time to run the "CRByDistrict"
report I want to pass in "CRByDistrict" and invoke
oReport = New <className> ' One line handles all reports
where in this case <className> is "CRByDistrict". I've looked at
Activator.CreateInstance and some other things, but I can't figure out
the best, simplest way to do this.
I'm tired of maintaining what has become a huge Select Case statement
each time I add a new report (class).
Thanks,
Brian