private void newDBItem_Click(object sender, EventArgs e) { String path = ""; saveFileDial1.Filter = "Access files mdb|*.mdb"; saveFileDial1.Title = "Select a database file"; saveFileDial1.InitialDirectory = @"C:\"; saveFileDial1.ShowDialog(); path = saveFileDial1.FileName; Variables.NewFilePath = path; frmNewDB newForm = new frmNewDB(); newForm.MdiParent = this; newForm.Show(); }
private void cmdCreate_Click(object sender, EventArgs e) { //Button to Create New MDB ... if (txtNewDBFile.Text.Trim() == "") { MessageBox.Show("Please provide valid path to the file!", "File Creation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtNewDBFile.Focus(); return; } Variables.NewFilePath = txtNewDBFile.Text.Trim(); if (File.Exists(Variables.NewFilePath)) { MessageBox.Show("File already existing! \n Sorry, we can not overwrite this file, please choose another name!", "File Creation Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtNewDBFile.Focus(); return; } else { frmNewDB newForm = new frmNewDB(); newForm.Show(frmMain.ActiveForm); } }