Learn How to call another .exe file in Window Based Applications using C# .

There are only two steps to call another .exe file from your window form.
Step 1.
Designing phase

    1.    Start visual stdio.
    2.    Create new project by File--New--Projects. It will look like….


           

   3.    Insert a Radio Button (if button is click then opera browser will be install and set  checked propert to false).
   4.    Insert a button (through which software will be install and set text propery to next)
   5.    Insert a Rich text box (in this terms and condition are shown.it will look like…..



  
  Step 2.
  Coding.
   1.    Firstly add the name space of “System.diagnostics”
   2.    Double click on button “Next” and paste the coding given below.
try
{
if (radioButton1.Checked == true)  // check if button is clicked or not
{
string str = @"E:\internet\INTERNET\setupopera.exe";   // this stiring store the address of the exe file and can be change according the location
Process process = new Process();    // this will create the object of the process class.
process.StartInfo.FileName = str; // this will store the information of location
process.Start(); // this will start the exeecution
}
else
{
MessageBox.Show("radio button not selected");
}
}
catch
{
MessageBox.Show(e.ToString());
}

 Note: Before running it just change your path of file otherwise it will give error.



  Notice : Now Please click on the below or right hand side Adds (image or text).
This was the last step.


                                                          Run and enjoy.


Post a Comment