I have a multi project solution in VB.Net. I have a custom made form, which other forms can inherit. It is in a seperate project called "CustomForm", there are no special graphical effects, it is the same as a generic Windows Form, just handles closing differently. I have a project called "TestProject1" with a form named Form1 in it, which inherits CustomForm. In the third project "TestManager", you can add an instance of Form1 from TestProject1, and set its ownership to TestManager. I have this setup with the following code inside TestManager:
Public Shared Sub CreateForm(ByVal frm As CustomForm.CustomForm)
frm.Owner = TestManager.TestManager
frm.Show()
End Sub
However I get the following error: 'Form1' is a type in 'TestProject1' and cannot be used as an expression.
EDIT: More Details:
Form1 has nothing on it at the moment. Imagine TestManager as a desktop, where a form from another project is added to it. TestManager references TestProject1, and used the code: CreateForm(TestProject1.Form1) which utilizes the above method. Now form1 references and inherits CustomForm. This error is displayed the moment I enter the code, so I cannot even build the project.
Due to my own stupidity, I oversaw such a simple error. I did not create an object or instance of the form, which was the issue. Simply had to add 'New' to the line.
CreateForm(New TestProject1.Form1())