I'm trying to have the option for the user to select variable different classes based on an user input. Unit_Alpha and Unit_Beta are two different classes that the user can choose from for the unit. Both Classes have the run() function that takes the same inputs and return value, but they do different calculations. As a result I don't think they can be the same class. When I dim the unit in the select case, visual basic does not like it. Is there a way to allow this or an alternative method?
Thanks in advance.
Select Case unitsearch.Text Case "Alpha" Dim unit As New Unit_Alpha Case "Beta" Dim unit As New Unit_Beta Case Else MsgBox("no unit properly selected") Exit sub End Select Answer = unit1.run(variables)