0

I wanting to add Command Line Arguments to my VB.Net project. Basically I want to pass my program a file path and a number (5 digits) which will then be assigned to 2 separate strings variables on form load. If either of these are not passed then an additional form is opened asking to locate the missing variables.

I know how to call the program with parameters using Process.Start but can't work adding the requirement to the loading project.

I have looked at lots of info on the web regarding this but cant make much sense, can anyone point me in the right direction

Thanks

1

1 Answer 1

1

Here is one way to do it:

For Each argument As String In My.Application.CommandLineArgs
  ' iterate through your arguments and make sure they passed as expected.
Next

References:

Last time I looked at it (not this, but a similar method), there was a problem with how arguments are parsed, and may be causing unexpected behavior in certain cases. Most of time you will not notice, but it's best to be prepared when it happens, check the article I wrote last year:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.