0

I have a windows service that initiates a console app process and calls it at a set time.

I believe I can use the Arguments property to pass a parameter to the called console app as such... process.StartInfo.Arguments = "0";

Where do I get this parameter within the console app ?

Main presumably gets passed this parameter in the string array...

static void Main(string[] args)
    {                 
        Application.Run(new Form1());
    }

Then in my Form1 class is it EventArgs e that contains this parameter?

public Form1()
    {
        InitializeComponent();
    }

    public void Form1_Load(object sender, EventArgs e)
    {
        MyClass dataprocess = new MyClass();
        dataprocess.InsertData(dataprocess.RetrieveData(my parameter to go here));
    }   

thanks for any help....

Mostafiz
  • 7,243
  • 3
  • 28
  • 42
user2895142
  • 69
  • 1
  • 6
  • 1
    They are not in the forms eventargs, instead simply query: `Environment.GetCommandLineArgs()` - Why are you calling a GUI app from a service? – Alex K. May 03 '16 at 11:24
  • there is no gui element as such, no client interaction it is simply running a process – user2895142 May 03 '16 at 12:03

0 Answers0