Saturday, 10 November 2012

Source code,Copy,move,delete File

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

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

        //browse1
        private void button1_Click(object sender, EventArgs e)
        {
            string cari = "";
            openFileDialog1.Filter = "All Files(*.*)|*.*";
            openFileDialog1.ShowDialog();
            cari = openFileDialog1.FileName;
            textBox1.Text = (cari);
        }

        //browse2
        private void button2_Click_1(object sender, EventArgs e)
        {
            string simpan = "";
            saveFileDialog1.Filter = "All Files(*.*)|*.*";
            saveFileDialog1.ShowDialog();
            simpan = saveFileDialog1.FileName;
            textBox2.Text = (simpan);
        }
        //delete file
        private void button5_Click_1(object sender, EventArgs e)
        {
            MessageBox.Show("Apa anda yakin ingin menghapus ?");
            File.Delete(textBox1.Text);
        }
        //moving file
        private void button4_Click_1(object sender, EventArgs e)
        {
            MessageBox.Show("Apa anda yakin ingin memindahkan?");
            File.Move(textBox1.Text, textBox2.Text);
        }
        //copy file
        private void button3_Click_1(object sender, EventArgs e)
        {

            MessageBox.Show("Apa anda yakin ingin mengopy?");
            File.Copy(textBox1.Text, textBox2.Text);
        }
       }
    }

     
   

0 komentar:

Post a Comment

Note: only a member of this blog may post a comment.