Click here to Skip to main content
15,907,236 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
DirectoryInfo dir;
string con = "";
SqlConnection _SqlConnection = null;
SqlCommand _SqlCommand = null;
string BackupPath_bak = Application.StartupPath + "\\Backup\\mybck_mbk_001";
string BackupPath = Application.StartupPath + "\\Backup\\mybck_mbk_002";
public BackUp()
{
InitializeComponent();
}
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{
if (msg.WParam.ToInt32() == (int)Keys.Enter)
{
SendKeys.Send("{Tab}");
return true;
}
if (msg.WParam.ToInt32() == (int)Keys.Escape)
{
this.Close();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
C#
private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = Application.StartupPath.ToString();
            openFileDialog1.Filter = "bak files (*.bak; *.mbk)|*.bak; *.mbk";
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FileName = Application.StartupPath + "\\Backup\\" + "PragatiDB" + "-" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                txtFileName.Text = openFileDialog1.FileName.ToString();
            }
        }
Posted
Comments
ZurdoDev 10-Feb-14 10:09am    
Do you have a question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900