
Invock a dll that has sub Main(), instead of a form as entry point
I want to remotely (from a web server) run a dll (Windows
Form application ) built with VB.Net. I can find and load
the assambly successfully. The only problem is that I
don't know how to start my program - because my program
not started with a form, but a sub Main() from a code
module. If it was started with a form, then the following
code will work:
strLocation = "http://MyServer/MyApp/MyPrg.dll"
Dim oStartAssembly As [Assembly] = [Assembly].LoadFrom
(strLocation)
Dim oType As Type = oStartAssembly.GetType("MyProj.Form1")
Dim oStartForm As Object = Activator.CreateInstance(oType)
Dim Form2 As Form = CType(oStartFrom, Form)
Form2.Show()
But I can't do this same thing with a program started with
sub Main(). The Activator.CreateInstance will faile
because the code mudule doesn't have a constructor.
Could someone point me to the right direction it would be
highly appreciated.
Lifeng