Run Program. This program works similarly like Run Program of Windows.


This program works similarly like Run Program of Windows. This program helps us to open any file in your directories by mentioning full path of any file in the textbox. We can manually enter the path of any file or we can browse the path. Learn alternate procedure for Run Program.

Alternate procedure for Run Program



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button3_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
comboBox1.Text = openFileDialog1.FileName;
}
comboBox1.Items.Add(openFileDialog1.FileName);
}

string s = "";
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.Text.Length != 0)
{
System.Diagnostics.Process.Start(comboBox1.Text);
}
else
{
MessageBox.Show("Enter any path to be opened.");
comboBox1.Focus();
}
}

private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}


Attachments

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: