Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to install Multiple softwares at One Place
WhatsApp
Neeraj Kumar
May 21
2015
1.9
k
0
0
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;
}
}
}
Up Next
How to install Multiple softwares at One Place