Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How to Send/Receive Command Line Parameter .NET 2.0 using C#

Author: DevAsp Team
Download Source Code : 664_commandlineparam.zip

In this simple article you will learn How can Send and Receive Command Line Parameter.

Simply just create New Project of Windows application in C# named CommandLineParam_main.

 

Drag one Rich Text Box and a button on the form.

 

 

Now write this code in Form1 class

 

public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

           

            System.Diagnostics.Process.Start("CommandLineParam_child",richTextBox1.Text);

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            this.Text = "Main Applicatoin";

        }

    }

 

Now Create another Application Named CommandLineParam_child.

 

Drag two Labels on form1.

 

Now write following code in Program.cs class

[STAThread]

        static void Main(string[] args)

        {

            Application.EnableVisualStyles();

            Application.SetCompatibleTextRenderingDefault(false);

            for(int i=0;i

                Form1.abc += args[i] + " ";

            Application.Run(new Form1());

        }

 

Now write code in Form1 events

 

public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            if (abc!="")

            {

                this.Text = abc;

                label2.Text = abc;

            }

            else

                label2.Text = "There is No String";

        }

    }

 

And declare a global variable in form1.designer.cs class

  public static string abc;

 

to aceess in all classes of application.

 

Compile child application and put its exe file in main debug Folder.

 

Then run main and call Child with specific parameters.

 

Article Comments
hi, above code is good, but i want to send AT command to modem by using serial port. please help me to find solution. i need in built function to send AT command.
Regards,
siddeswara

Posted on 8/21/2007 8:39:05 AM by siddeswara

how to send AT command to modem by using serial port

Posted on 1/20/2010 11:02:17 PM by Ramesh

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to display a Table from Database in GridView Control on Run time using .NET 2.0

Disclaimer - Privacy
© 2002-2017 DevASP.net