how can i launch a specific .net form from outside of the exe? using a batch file
I have a .net application, i would like for any specific form to be launched using a batch file...
now i know if i...
click on the solution properties and then click the debug tab select the start action under start options, i can specify command line arguments.
What do I need to type in the command line arguments to launch any specific form?
I tried this in the batch file, but it doesn't work:
how can i get my application to recognise these commands and launch the right form? or what other way can i do it?
I have figured it out...
First under the command line arguments I added the commands, within the solution properties.
Then in Application.Designer.vb (Program.cs Main() if you're using c#) Under
Protected Overrides Sub OnCreateMainForm()
I added the following...
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ Protected Overrides Sub OnCreateMainForm() Try If Me.CommandLineArgs(0) = "/a" Then test.openForm1() ElseIf Me.CommandLineArgs(0) = "/b" Then test.openForm2() ElseIf Me.CommandLineArgs(0) = "/c" Then test.openForm3() End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub
test is the name of the exe i'm compiling.
this in the batch file, this works...
You MUST remember to specify AT LEAST ONE command line argument in your project properties, it can be any value, just not empty.
Click on DEBUG in the project properties > go to the Start Options > Command Line Arguments: "/anything"
If you miss this out, you may get a System.Argument.OutOfRangeException / Index was out of range.