WARNING #1047

    Application will terminate when Sub Main() finishes.

    See also: How to prevent the application from exiting inmediately after starting?

    Sample VB6

    Sub Main()
    Form1.Show
    Dim x AsInteger
    x = 10

    EndSub

    Target VB.NET

    Module Module1
       'UPGRADE_WARNING: (1047) Application will terminate when Sub Main() finishes.
       PublicSub Main()
          Form1.Show()
          Dim x AsInteger = 10
       EndSub
    EndModule

    Expected VB.NET

    Module Module1
       'UPGRADE_WARNING: (1047) Application will terminate when Sub Main() finishes.
       PublicSub Main()
          Application.Run(Form1)

          Dim x AsInteger = 10
       EndSub
    EndModule

    Target C#

    classModule1
    {
       //UPGRADE_WARNING: (1047) Application will terminate when Sub Main() finishes.
       staticpublicvoid Main()
       {
          Form1.DefInstance.Show();
          int x = 10;
       }
    }

    Expected C#

    classModule1
    {
       //UPGRADE_WARNING: (1047) Application will terminate when Sub Main() finishes.
       staticpublicvoid Main()
       {
          Application.Run(Form1.DefInstance);
          int x = 10;
       }
    }


    Download VBUC Free Trial
    Download VBUC Now

    It's time to eradicate VB6
    ROI of eradicating VB6

    8 Proven Tips for
    Planning a Successful Migration

    8 Tips for migration