By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Reading an argument given to the program when started

P: n/a
Hi

I am busy trying to create a VB.NET program. I want to give the program an
argument in the shortcut I created for that program (for example:
program.exe argument).
Now I just can't find how I can read that argument in my VB.NET program.

Can anyone help me?

Thanks
Joris
Mar 31 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try Environment.GetCommandLineArgs or Environment.CommandLine

/claes
"Joris De Groote" <jo************@skynet.be> wrote in message
news:eu**************@TK2MSFTNGP14.phx.gbl...
Hi

I am busy trying to create a VB.NET program. I want to give the program an
argument in the shortcut I created for that program (for example:
program.exe argument).
Now I just can't find how I can read that argument in my VB.NET program.

Can anyone help me?

Thanks
Joris

Mar 31 '06 #2

P: n/a


public class MyProgram
public shared Sub Main(args() as string)

'args contains an array of strings representing the command line
dim mainForm as new MyForm(args)

Application.Run(mainForm)
end
hth,
Alan

Mar 31 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.