How to install Multiple softwares at One Place

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Diagnostics;  
  6. using System.Drawing;  
  7. using System.Linq;  
  8. using System.Text;  
  9. using System.Threading.Tasks;  
  10. using System.Windows.Forms;  
  11.   
  12. namespace InstallMulti  
  13. {  
  14.     public partial class InstallMulti : Form  
  15.     {  
  16.         int row=0,rowindex,cellindex;  
  17.           
  18.         public InstallMulti()  
  19.         {  
  20.             InitializeComponent();  
  21.         }  
  22.   
  23.         private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)  
  24.         {  
  25.             if (row > 0)  
  26.             {  
  27.                 if (cellindex == 0)  
  28.                     Process.Start(dataGridView1.Rows[rowindex].Cells[1].Value.ToString());  
  29.                 if (cellindex == 2)  
  30.                 {  
  31.                     dataGridView1.Rows.RemoveAt(rowindex);  
  32.                     row--;  
  33.                 }  
  34.   
  35.             }  
  36.         }  
  37.   
  38.         private void button1_Click(object sender, EventArgs e)  
  39.         {  
  40.               
  41.             OpenFileDialog openFileDialog1 = new OpenFileDialog();  
  42.   
  43.             openFileDialog1.InitialDirectory = @"C:\";  
  44.             openFileDialog1.Title = "Browse exe Files";  
  45.   
  46.             openFileDialog1.CheckFileExists = true;  
  47.             openFileDialog1.CheckPathExists = true;  
  48.   
  49.             openFileDialog1.DefaultExt = "exe";  
  50.             openFileDialog1.Filter = "Executable files (*.exe,*.msi)|*.exe";  
  51.             openFileDialog1.FilterIndex = 1;  
  52.             openFileDialog1.RestoreDirectory = true;  
  53.               
  54.             openFileDialog1.ReadOnlyChecked = true;  
  55.             openFileDialog1.ShowReadOnly = true;  
  56.   
  57.             if (openFileDialog1.ShowDialog() == DialogResult.OK)  
  58.             {  
  59.                 textBox1.Text = openFileDialog1.FileName;  
  60.             }  
  61.   
  62.             DialogResult dr = new DialogResult();  
  63.             if(textBox1.Text!="")  
  64.             {  
  65.                 dr = MessageBox.Show("Do u want to  execute software ?""Information ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);  
  66.                 if(DialogResult.Yes==dr)  
  67.                 {  
  68.                     this.dataGridView1.Rows.Add();  
  69.                     this.dataGridView1.Rows[row].Cells[0].Value = (row + 1).ToString() + " Click Here for Install";  
  70.                     this.dataGridView1.Rows[row].Cells[1].Value = textBox1.Text;  
  71.                     this.dataGridView1.Rows[row].Cells[2].Value = "Remove";  
  72.                     row++;  
  73.                 }  
  74.                 else  
  75.                 {  
  76.                     textBox1.Text = "";  
  77.                 }  
  78.             }  
  79.         }  
  80.   
  81.          
  82.   
  83.         private void dataGridView1_MouseClick(object sender, MouseEventArgs e)  
  84.         {  
  85.             if (e.Button != System.Windows.Forms.MouseButtons.Left) { return; }  
  86.   
  87.             DataGridView dgv = (DataGridView)sender;  
  88.   
  89.             // Use HitTest to resolve the row and column under the cursor  
  90.              rowindex = dgv.HitTest(e.X, e.Y).RowIndex;  
  91.              cellindex = dgv.HitTest(e.X, e.Y).ColumnIndex;  
  92.              
  93.               
  94.         }  
  95.   
  96.          
  97.     }  
  98. }