Friday, 5 July 2013

Assignment:create an application like RUN


create new form place three buttons open file, cancel process or browse file from hard drive
source code of above forn as follows:

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 WindowsFormsApplication3
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog dv = new OpenFileDialog();
            dv.InitialDirectory = @"c;\";
            if (dv.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = dv.FileName;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult d;
            d = MessageBox.Show("you want to EXIT", "quit", MessageBoxButtons.YesNo);
            if (d == DialogResult.Yes)
            {
            this.Close();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s=textBox1.Text;
            System.Diagnostics.Process.Start(s);

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}

No comments:

Post a Comment