user1341926
user1341926

Reputation: 81

parameters in visual basic 2010

how can use parameters in my vb application?

i want to make it so that when the parameter its "/y" i want some thing like this to hapen

if parameter = "/y" then 
    msgbox("you used the parameter /y")
else
    msgbox("you dint use any parameter")
end if

i want some thing like this to hapen when i use the parameter "/y" the parameters are used when for ex: im running the .exe on cmd

Upvotes: 0

Views: 284

Answers (2)

Jeff Watkins
Jeff Watkins

Reputation: 6357

You can change Sub Main() to

Sub Main(ByVal cmdArgs() As String) 

And use the argument array that way. This has been valid in VB.NET for many versions.

Upvotes: 2

Oded
Oded

Reputation: 499212

The passed in command line arguments will be available to the Main procedure of your application.

These come in as an array of strings.

Upvotes: 0

Related Questions