P
Paul
I have two projects in one solution. One is called Frontier and holds
all my base user controls, classes, etc. that are used over multiple
applications. The second is my application project (OCFU) which holds
the forms and code that the users run. I need to instantiate a new
form only given the form's name in a string. In the calling form in
the OCFU project I used the following code:
Dim objNewForm As Object =
Activator.CreateInstance(Type.GetType(myApplicationName & "." &
FormToOpen))
Dim frm As FrontierForm = DirectCast(objNewForm, FrontierForm)
The "myApplicationName & "." & FormToOpen" code fully qualifies the
form. The myApplicationName is a global variable of the application
name, in this case OCFU. It works when the code is in a form from
within the OCFU project.
I then copied this code to a class in the Frontier project so that it
is reusable by multiple applications. Then I commented out the code in
the OCFU form. Now it doesn't work. The Type.GetType procedure
returns Nothing. It's as if it cannot find the OCFU project and the
form within it. Am I missing additional qualification?
all my base user controls, classes, etc. that are used over multiple
applications. The second is my application project (OCFU) which holds
the forms and code that the users run. I need to instantiate a new
form only given the form's name in a string. In the calling form in
the OCFU project I used the following code:
Dim objNewForm As Object =
Activator.CreateInstance(Type.GetType(myApplicationName & "." &
FormToOpen))
Dim frm As FrontierForm = DirectCast(objNewForm, FrontierForm)
The "myApplicationName & "." & FormToOpen" code fully qualifies the
form. The myApplicationName is a global variable of the application
name, in this case OCFU. It works when the code is in a form from
within the OCFU project.
I then copied this code to a class in the Frontier project so that it
is reusable by multiple applications. Then I commented out the code in
the OCFU form. Now it doesn't work. The Type.GetType procedure
returns Nothing. It's as if it cannot find the OCFU project and the
form within it. Am I missing additional qualification?