Selecting which form to load using command line parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 85ssp
    New Member
    • Mar 2008
    • 6

    Selecting which form to load using command line parameters

    I am working on debugging a multithreaded network application. I have two forms. One of which is my testing form, the other is the actual user form. I need to be able to load only my testing form when testing and then load my other form. I was thinking i could do this using command line parameters but i'm not sure where to put my code. If anyone has any idea on how i could accomplish this it would very helpful.

    [CODE=vb]Sub Main()
    Dim a_strArgs() As String
    Dim strFilename As String
    Dim i As Integer

    a_strArgs = Split(Command$, " ")
    For i = LBound(a_strArg s) To UBound(a_strArg s)
    Select Case LCase(a_strArgs (i))

    Case "-t", "/t"
    testingform.Sho w()

    Case "-m", "/m"
    mainform.show()

    Case Else
    MsgBox("Invalid argument: " & a_strArgs(i))
    End Select

    Next i
    End Sub[/CODE]
    Last edited by Killer42; Mar 11 '08, 02:08 AM. Reason: Added CODE=vb tag
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    What you've got seems fine to me. What's the problem with it?

    Um... assuming this is VB6, you might have forgotten to set the startup object to "Sub Main" under the Project Properties.

    Comment

    Working...