private void cmdOpen(object sender, EventArgs e) { OpenFileDialog dlgOpen = new OpenFileDialog(); dlgOpen.InitialDirectory = lastDir; dlgOpen.Filter = "Order Files (*.ord)|*.ord"; // Show the open dialog. if (dlgOpen.ShowDialog() == DialogResult.OK) { Order doc = new Order(); try { doc.Open(dlgOpen.FileName); } catch (Exception err) { // All exceptions bubble up to this level. MessageBox.Show(err.ToString()); return; } // Create the child form for the selected file. Child frmChild = new Child(doc, Child.ViewType.ItemGrid); frmChild.MdiParent = this; frmChild.Show(); } }
public void Open() { OpenFileDialog dlgOpen = new OpenFileDialog(); dlgOpen.InitialDirectory = lastDir; dlgOpen.Filter = "Order Files (*.ord)|*.ord"; // Show the open dialog. if (dlgOpen.ShowDialog() == DialogResult.OK) { Order doc = new Order(); try { doc.Open(dlgOpen.FileName); } catch (Exception err) { // All exceptions bubble up to this level. MessageBox.Show(err.ToString()); return; } // Create the child form for the selected file. Child frmChild = new Child(doc, Child.ViewType.ItemGrid); Program.DocumentManager.AddForm(frmChild); frmChild.Show(); } }