This is the original Nevron example code:
static class Program
{
[STAThread]
static void Main()
{
App app = new App();
NModule[] modules = new NModule[] {
// TODO: Create modules here
};
NNOVApplicationInstaller.Install(modules);
app.Run(new MainWindow());
}
}
And this is my rough approximation:
Public NotInheritable Class Program
Private Sub New()
End Sub
<STAThread> _
Shared Sub Main()
Dim app As Application = New Application()
Dim modules As NModule() = New NModule() {}
NNOVApplicationInstaller.Install(modules)
app.Run(New MainWindow)
End Sub
End Class
Yet when I try and compile, I get this brain frazzling error:
'Sub Main' is declared more than once in 'DataMonitor.Visuals': DataMonitor.Visuals.Program.Main(), DataMonitor.Visuals.Application.Main() DataMonitor.Visuals
Yet There is no Main
anywhere else in the entire project, only in my class.
By default, the Application Framework is enabled for VB.NET projects. That creates the Main
method for you in code that you can't access. If you want to write your own Main
method then you have to disable the Application Framework in the project properties.
Note that, with the Application Framework enabled, you're supposed to handle the Startup
event of the application, which you can access from the project properties also. That event is raised from the auto-generated Main
method.