In VB.net (2005) by default "Application Framework" is enabled. You
can disable this feature and then select the "Sub Main" as Startup
Object.

Above option can be found in My Project->Application Settings page.


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