Home All Groups Group Topic Archive Search About

parameter to the file .exe

Author
10 Feb 2006 5:32 PM
Franky
the file .exe in the vbnet can received a parameter
how can i received this parameter by code ??

Author
15 Feb 2006 9:25 AM
Aboulfazl Hadi
Hi
if you use VS.2005 & your project type is Windows Application

Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles
Me.Startup
            Dim firstParameter As String
            firstParameter = e.CommandLine(0)

End Sub
End Class

and if it is Console Application :

    Sub Main(ByVal args() As String)
        Dim firstParam As String
        If args.Length > 0 Then
            firstParam = args(0)
        End If
    End Sub



A.Hadi