Results 1 to 2 of 2

Thread: [2008] Display command line from new instance

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2003
    Location
    Cleveland, OH
    Posts
    41

    [2008] Display command line from new instance

    (VS2008) Have a label displayed on the startup form (lblTID). When a second instance of the app is called with a command line, I want to display the command line text string in lblTID.text on the startup form. I'm setting the lblTID object in StartupNextInstance, but the lblTID text object is not displaying the command line text string. As a matter of fact, I'm not able to change any text objects on the startup form from StartupNextInstance.

    Here is my code:

    Code:
    Partial Friend Class MyApplication
    
        Private Sub MyApplication_StartupNextInstance(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs) _
        Handles Me.StartupNextInstance
            strCommandLine = e.CommandLine.Item(0)
            frmStartup.lblTID.Text = strCommandLine
            e.BringToForeground = True
        End Sub
    
    End Class

  2. #2
    Addicted Member joe1985's Avatar
    Join Date
    Jun 2007
    Posts
    151

    Re: [2008] Display command line from new instance

    Code:
     Dim s As String() = Environment.GetCommandLineArgs()
            Button1.Text = s(1)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width