How can i export or compile a form that i make with code within a running application in VB.NET?
I’m making a simple form making application, i’ve got almost everything covered, with creating the new form and adding controls and stuff.
Example: create a new form with clicking a button:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim NewForm As New Form
NewForm.Name = "Form1"
NewForm.Text = "Form1"
NewForm.Width = 300
NewForm.Height = 300
NewForm.Show()
End Sub
How do i export or compile the new form to a standalone exe?
Any help is greatly appreciated.
Create your own file format (XML?) that describes the contents of the form.
Then, create a separate application that reads these files and display a form based on the file that it read.
If you want to ship single EXEs, you could embed the file as a resource in the launcher application and modify that resource to save custom EXEs.
Alternatively, you could use Roslyn or Mono Cecil or Expression trees to actually compile that code at runtime into a new EXE; that may be harder.