Assuming that you have moved the Main procedure to a new class/module,
you should be able to set the startup object of your project to that
Class/Module. This will then provide an entry point to your
application via the Shared Sub Main.

VB.NET does have this tendency to obscure the most important parts of
an application flow from the developer.

On Dec 21, 10:57 pm, Pablo <[email protected]> wrote:
> I'm trying to translate the following code from C# into vb.net:
>
> [STAThread]
> static void Main()
> {
>         if( --A boolean operation goes here-- )
>                 {
>                         MessageBox.Show( "Cannot start application.");
>                         return;
>                 }
>
>         Form1 frm = new Form1();
>         Application.Run( frm );
>
> }
>
> The vb.net equivalent would be:
>
> <STAThread()> _
> Shared Sub Main()
>
>         If --A boolean operation goes here-- Then
>             MessageBox.Show( "Cannot start application.")
>         Else
>             Application.Run(New Form1)
>         End If
>
> End Sub
>
> What I’m trying to do is do some testing before Form1 is displayed, if
> the expected conditions are not met the application is terminated.
> The problem is: the c# application works fine, however the vb.net
> version the Main() sub is not executed, the application runs no matter
> what.
>
> Any advise?
>
> Thanks.

Reply via email to