Hello,
I'm currently making a text editor, and I wanted to make my application accept arguments from the command prompt, you know <Directory>\myapp.exe <textfile>. How can I do this?
Thanks in advance :D
Printable View
Hello,
I'm currently making a text editor, and I wanted to make my application accept arguments from the command prompt, you know <Directory>\myapp.exe <textfile>. How can I do this?
Thanks in advance :D
Environment.GetCommandlineArgs will get you an array any time. You can also access them in the application Startup event via the 'e' parameter.
Enviroment.GetCommandlineArgs should be at the Form.Load event? When you say:You are talking about the Form.Load event,right?Quote:
You can also access them in the application Startup event via the 'e' parameter.
That's completely up to you. Do you need the commandline arguments in the Form's Load event handler? If so then that's where you should call the method. If you need them somewhere else then you call it soemwhere else.No, if I'd meant that I would have said that. I mean the Startup event of the application itself. You can access application events from the project properties.
Oh, ok. Got it. Thanks a lot John :).
Thread Resolved!