Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, September 25, 2013 1:32 AM
Hi,
I have one exe file, i need to pass two arguments to that exe file.
How to pass arguments to that exe file and how to get that arguments in the code.
Ex: I have class Name Calculations.
I have Add Method
Public Void Add()
{
//Here how to get that Arguments from EXe File and to execute
//Suppose arguments are a=10, b=20 //how to get these values from command line argument.
Int a , b, c;
c=a+b;
}
Thanks
All replies (2)
Wednesday, September 25, 2013 2:10 AM âś…Answered
Hi Thanks for your Reply Careed,
But In My Progam I don't Have Above you are given Main Method. Sorry the progam in VB.net
public static void Main(string[] arguments) {}
My Program structure Like below.
Imports System.Data
Module A
**Public Function Main() As Integer //This is the only Function i have in my program
**
//Here In this Main() Methos I need to Pass Command Line Arguments
//How can i pass the arguments.
End Function
End Module
**
**
I found one link how to pass command line arguments to Module in vb.net
http://msdn.microsoft.com/en-us/library/ms235406.aspx
Thanks ,
Wednesday, September 25, 2013 1:38 AM
To pass the arguments, just include in your command from the command prompt:
MyApp.exe Arg1 Arg2
In the app, you need to use the Main method with the arguments parameter:
public static void Main(string[] arguments)
{
string arg1 = arguments[0];
string arg2 = arguments[1];
...
}
Then you can call your Add method from the Main method.