Thread: [RESOLVED] Launching Windows Forms Application from Command Line with arguments

RudyL is offline

Frenzied Member Join Date Mar 2001 Location Chicago Posts 1,519

[RESOLVED] Launching Windows Forms Application from Command Line with arguments

Back in the VB6 days I could launch my application from a command line and pass along some arguments - I can't seem to get that to work in 2013 when setup as a windows forms application. Is it possible to do that anymore? I ask because if it is I don't really want to change the application (mostly because i'm not sure how at this point) to a console app. Plus, I need to be able to launch from both the console and the EXE file.

10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

May 19th, 2015, 04:24 PM #2

RudyL is offline

Thread Starter

Frenzied Member Join Date Mar 2001 Location Chicago Posts 1,519

Re: Launching Windows Forms Application from Command Line with arguments

Dim Args() As String Args = Environment.GetCommandLineArgs

10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

May 19th, 2015, 05:21 PM #3

passel is offline

Sinecure devotee Join Date Aug 2013 Location Southern Tier NY Posts 6,578

Re: [RESOLVED] Launching Windows Forms Application from Command Line with arguments

QuoteOriginally Posted by RudyL View Post

. I don't really want to change the application (mostly because i'm not sure how at this point) to a console app.

Yeah, I wouldn't turn a form's application into a console application, although a console application is much easier to do in .Net then it was in VB6.
A couple of my first few programs I tried out in .Net were console application ports of QBASIC console applications, which I did just because .Net supported console applications. Translating the console application from QBASIC to .Net was an entertaining way to learn how to do a .Net console project.
Of course, I had already done a VB6 form version, that emulated the look and feel of the program running in a console window, for both programs many years ago.
The QBASIC version of a perpetual calendar program I wrote, and the Console Version (done in VB.Net 2005 originally) can be found in this post, if you're curious.