In my project I have four forms. Is there a way to store a form in a dll file instead of storing it in the exe file. I want to be able to call the form to show just like I would normally. If there are any links on how to do this in vb.net that would be great also. Thanks.

Storing a form in a dll
a.i.
Or is that just too complicated to be feasible
Thanks for the quick response.
George.Saliba
Start a new project as an ActiveX DLL and put the forms into it. Compile it, then create a new project and include the DLL you used as a reference. You can then create a new object to represent the DLL, and call the forms inside it by using the .Show() method.
Hope you find this useful!
Eric23
I Use the following code to make the form open in a tab (this code is part of Form1.vb, not part of the dll).
Private Function newTab() As Boolean
Try
TabControl1.SelectTab(newPage)
Catch ex As Exception
newForm.TopLevel = False
newForm.Dock = DockStyle.Fill
newForm.Visible = True
newPage.Controls.Add(newForm)
TabControl1.TabPages.Add(newPage)
End Try
End Function
Private Sub menu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles menu.Click
newForm = New Class1.Class1 : newPage.Text = "Class1" : newTab()
End Sub
Now the form that opens has a button to close the tab and remove it from the Tab Control. I used the following code when the form was still part of my project.
Form1.TabControl1.TabPages.Remove(Form1.TabControl1.SelectedTab)
Now, since I cannot reference Form1 (since the form is now part of an external dll) I use the following.
Me.Parent.Controls.Clear()
This removes the form from the tab but the tab still remains. There is no way (that I can find) to remove the tab from the Tab Control (since I cannot reference Form1, I cannot reference TabControl1 on it).
This is the only problem I am having right now. Thank you for any help you can provide.
Michal Levy
Also, I used 'Add Existing Item..' and added my form Form2.vb to the project. Now I have 102 errors. Some errors are like:
Type 'System.Windows.Forms.Form' is not defined.
Type 'System.Windows.Forms.ToolStrip' is not defined
and so on for all of my controls.
I obviously did something wrong. Any idea why it is doing this Thank you for your response.
Vahid66
Superboy
reference it by going to project menu and selecting "add reference" and then select your dll. You could also create a project level reference by including the dll project in your exe solution
HTH
Sreekanth Ammisetty
Here's two similar ways of doing it:
Capture the Click event of the button in the tab page, and handle the tab removal in it.
Or a little bit more advanced, create a delegate variable for the form that's going to be hosted in the tab page, point it to a method for handling the tab removal.
TomPepe
Now I have another question. I want it to be a standalone dll. It will be stored in the same directory as my exe file. How would I reference it. I tried the normal methods but since in is not part of my solution it gives errors.
Thanks.
arvindbksc
And don't worry about it robinjam. Nobody is perfect.
Matanel Sindilevich
question mark
Yea you chose the correct one, a Class Library project compiles a dll instead of an exe. If you are using Windows Forms then you need to add a reference to System.Windows.Forms.dll, which isn't added for you automatically(unlike Windows Application Project) when creating a Class Library Project.
nathan koterba
joseadolfo
Vonfranzken