TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to install Multiple softwares at One Place
Neeraj Kumar
May 21
2015
Code
1.8
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
InstallMulti.rar
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Diagnostics;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
InstallMulti
{
public
partial
class
InstallMulti : Form
{
int
row=0,rowindex,cellindex;
public
InstallMulti()
{
InitializeComponent();
}
private
void
dataGridView1_CellContentClick(
object
sender, DataGridViewCellEventArgs e)
{
if
(row > 0)
{
if
(cellindex == 0)
Process.Start(dataGridView1.Rows[rowindex].Cells[1].Value.ToString());
if
(cellindex == 2)
{
dataGridView1.Rows.RemoveAt(rowindex);
row--;
}
}
}
private
void
button1_Click(
object
sender, EventArgs e)
{
OpenFileDialog openFileDialog1 =
new
OpenFileDialog();
openFileDialog1.InitialDirectory = @
"C:\"
;
openFileDialog1.Title =
"Browse exe Files"
;
openFileDialog1.CheckFileExists =
true
;
openFileDialog1.CheckPathExists =
true
;
openFileDialog1.DefaultExt =
"exe"
;
openFileDialog1.Filter =
"Executable files (*.exe,*.msi)|*.exe"
;
openFileDialog1.FilterIndex = 1;
openFileDialog1.RestoreDirectory =
true
;
openFileDialog1.ReadOnlyChecked =
true
;
openFileDialog1.ShowReadOnly =
true
;
if
(openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
}
DialogResult dr =
new
DialogResult();
if
(textBox1.Text!=
""
)
{
dr = MessageBox.Show(
"Do u want to execute software ?"
,
"Information ?"
, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if
(DialogResult.Yes==dr)
{
this
.dataGridView1.Rows.Add();
this
.dataGridView1.Rows[row].Cells[0].Value = (row + 1).ToString() +
" Click Here for Install"
;
this
.dataGridView1.Rows[row].Cells[1].Value = textBox1.Text;
this
.dataGridView1.Rows[row].Cells[2].Value =
"Remove"
;
row++;
}
else
{
textBox1.Text =
""
;
}
}
}
private
void
dataGridView1_MouseClick(
object
sender, MouseEventArgs e)
{
if
(e.Button != System.Windows.Forms.MouseButtons.Left) {
return
; }
DataGridView dgv = (DataGridView)sender;
// Use HitTest to resolve the row and column under the cursor
rowindex = dgv.HitTest(e.X, e.Y).RowIndex;
cellindex = dgv.HitTest(e.X, e.Y).ColumnIndex;
}
}
}