Steve Williams
asked on
How to Add Command Line Aurguments to your VB.Net Code in Visual Basic Language
I have looked on a few VB forums and Googled till my eyes started bleeding. There is almost no information or examples of how to add command line arguments to your project so you can run functions of a compiled .exe file. Here is some code I have been working on to add the arguments. Very simple functions are to hide the form and click button1 on load.
Here is a screenshot of the Project Properties window with the Command Line arguments. This does not help it function in debug mode.
Any help on this would be greatly appreciated. (My code doesn't work) If anyone knows the correct method for creating these switches please help me.
Private Sub frmForm1_Load(sender As Object, e As EventArgs) Handles Me.Load
CommandLineArgs()
End Sub
Public Function CommandLineArgs()
Dim clArgs As String = Environment.CommandLine
For Each s As String In clArgs
Select Case s.ToLower
Case "/r"
Button1.PerformClick()
Case "/h"
Me.Visible = False
End Select
Next
Return CommandLineArgs(clArgs)
End Function
Here is a screenshot of the Project Properties window with the Command Line arguments. This does not help it function in debug mode.
Any help on this would be greatly appreciated. (My code doesn't work) If anyone knows the correct method for creating these switches please help me.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fernando Soto's solution was quick and simple and it worked like a charm.
I give Eric kudos for all the work he did on that article it was very nice and it has downloadable code which I'm going to put in my library for future use when and if I ever get that in depth in coding. I'm a Mechanical engineer by trade and only dabble in coding to support my Engineering requirements. I will say tho, coding is a lot of fun and I really enjoy the time I get to spend with it.
As always, you guys rock thanks again for your help.