private void ShowNewForm(object sender, EventArgs e) { openDBFileDialog.InitialDirectory = Application.StartupPath; openDBFileDialog.Filter = "MS Access files (*.mdb)|*.mdb"; if (openDBFileDialog.ShowDialog(this) == DialogResult.OK) { String fileName = openDBFileDialog.FileName; databasename = System.IO.Path.GetFileNameWithoutExtension(fileName); strokendiagramFileName = System.IO.Path.GetDirectoryName(fileName) + "\\" + databasename + ".png"; if (System.IO.File.Exists(strokendiagramFileName)) { strokendiagramToolStripMenuItem.Enabled = true; } CloseDatabase(); if (OpenDatabase(fileName)) { DBForm childForm = new DBForm(connection); childForm.MdiParent = this; childForm.Text = databasename; childForm.Show(); sqlMenuItem.Enabled = true; databaseMenuItem.Enabled = true; closeToolStripMenuItem.Enabled = true; toolStripStatusLabel.Text = "Actieve database: " + fileName; } } }
private void databaseMenuItem_Click(object sender, EventArgs e) { DBForm childForm = new DBForm(connection); childForm.MdiParent = this; childForm.Text = databasename; childForm.Show(); }