Sub Main not being executed in complied program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ThomasHo
    New Member
    • Jan 2016
    • 2

    Sub Main not being executed in complied program

    Hi there,

    I've written a Programm which shall be started with or without Parameters. Without Parameters, a setup-form is loaded, with Parameters, a FTP-Transfer-form is loaded. I've included a Sub main-procedure and deactivated the Framework and everything works fine but only within the IDE. If I start the compiled exe-file, the Sub main is noz executed.
    Here's the code:
    Code:
    Public Sub Main()
            Dim lDoSetup As Boolean = False
            Dim aCom As String() = Environment.GetCommandLineArgs
            If aCom.Length > 0 Then
                If aCom.Length = 1 Then
                    If Debugger.IsAttached Then
                        lDoSetup = True
                    End If
                End If
            Else
                lDoSetup = True
            End If
    
            If lDoSetup Then
                MsgBox("Setup ist True")
            End If
    
            If lDoSetup Then
                Application.Run(New SetupFRM)
            Else
                Application.Run(New FTPFRM(aCom))
            End If
        End Sub
    so when called without Parameters, SetupFRM should be loaded but isn't. So it seems that this code is not executed but FTPFRM loaded when the exe is started(I forgot to mention above, that Sub main is selected as start-object)
    Hay anybody any idea what might cause this.

    Best regards

    Thomas
  • ThomasHo
    New Member
    • Jan 2016
    • 2

    #2
    Problem is solved. There are two Errors:

    1. Msgbox is not being shown. I use messagebox.show .instead.
    2. There is always a first commandline-arg containig the program-Name. So the setup-form has never been called.

    Best regards

    Thomas

    Comment

    Working...