Social Icons

Pages

Monday, 2 July 2012

SaveDialog Box


            private void BackUp_Load(object sender, EventArgs e)
           {
            this.textBox1.ReadOnly = false;
            spath = "D:/bssdata/bss/FileName.mdb";
            textBox1.Text = spath;
           }
           SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            saveFileDialog.Filter = "Database Files (*.mdb)|*.mdb|All Files (*.*)|*.*";
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                path = saveFileDialog.FileName;
            }

if (File.Exists(path))
            {
                File.Delete(path);
                File.Copy(spath, path);
                if (MessageBox.Show("The Database File Backup has taken", "Backup Process", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.OK)
                {
                    this.Close();
                }
            }
            else
            {
                File.Copy(spath, path);
                MessageBox.Show("The  Database File Backup has taken", "Backup", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

0 comments:

 

Sample text

Your Comments