Esempio n. 1
0
        private void cmdOpen_Click(object sender, EventArgs e)
        {
            if (txtOpenFile.Text.Trim() == "")
            {
                MessageBox.Show("Please provide valid path to the file!", "Open Database",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtOpenFile.Focus();
                return;
            }
            string path = txtOpenFile.Text.Trim();

            if (File.Exists(path))
            {
                Variables.OpenFilePath = path;
                frmOpenDB newForm = new frmOpenDB();
                newForm.ShowDialog(frmMain.ActiveForm);
            }
            else
            {
                Variables.OpenFilePath = "";
                MessageBox.Show("Please provide valid path to the file!", "Open Database",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtOpenFile.Focus();
                return;
            }
        }
Esempio n. 2
0
        private void openDBItem_Click(object sender, EventArgs e)
        {
            String path = "";

            openFileDial1.Filter     = "Access files mdb|*.mbd|Access file accdb|*.accdb|All files|*.*";
            openFileDial1.DefaultExt = "*.mdb";
            openFileDial1.FileName   = "*.mdb";
            openFileDial1.ShowDialog();
            path = openFileDial1.FileName;
            Variables.OpenFilePath = path;

            frmOpenDB newForm = new frmOpenDB();

            newForm.MdiParent = this;
            newForm.Show();
        }