private void btnNext_Click(object sender, EventArgs e) { string fileName = txtFileName.Text + ".accdb"; string folderpath = txtFolderPath.Text + "/"; try { DBEngine dbeng = new DBEngine(); Database mydb; mydb = dbeng.CreateDatabase(folderpath + fileName, DAO.LanguageConstants.dbLangGeneral); MessageBox.Show("Data Base file " + fileName + " has been created", "Creation", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); wizardTable wiztable = new wizardTable(fileName, mydb, false); wiztable.MdiParent = mainForm.ActiveForm; wiztable.Show(); } catch { MessageBox.Show("Data Base " + fileName + " exist\nSelect other filename", "File Exist", MessageBoxButtons.OK, MessageBoxIcon.Error); txtFileName.Text = ""; } }
private void menuOpen_Click(object sender, EventArgs e) { try { DBEngine dbeng = new DBEngine(); openDiagDBFile.ShowDialog(); Database mydb = dbeng.OpenDatabase(openDiagDBFile.FileName); wizardTable openTables = new wizardTable(openDiagDBFile.FileName, mydb, true); openTables.MdiParent = this; openTables.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// Receive DB Name, Database from previous Form public wizardRelationships(string dbname, Database db) { InitializeComponent(); lblDBName.Text = dbname; mydb = db; wizardTable wt = null; // Search RelationShip Form already active for (int i = Application.OpenForms.Count - 1; i >= 0; i--) { if (Application.OpenForms[i].GetType() == typeof(wizardTable)) { wt = (wizardTable)Application.OpenForms[i]; } } if (wt != null) { wt.relationRefresh += refreshThis; } wizardTable.ActiveForm.WindowState = FormWindowState.Maximized; }