Example #1
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EditForm form=new EditForm();
            DialogResult result = form.ShowDialog();
            if (result == DialogResult.OK && form.Result != null)
            {

                    if (ActiveMdiChild == null)
                    {
                        newToolStripMenuItem_Click(sender,e);
                    }

                var table = (Table) ActiveMdiChild;
                table?.Museums.Add(form.Result);
            }
        }
Example #2
0
 private void editATigerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveMdiChild == null)
     {
         MessageBox.Show("Не открыто ни одной формы", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         return;
     }
     Table table = (Table)ActiveMdiChild;
     Museum t = (Museum)table.DataGridView.CurrentRow?.DataBoundItem;
     if (t != null)
     {
         int index = table.Museums.IndexOf(t);
         using (EditForm editForm=new EditForm(t))
         {
             var result = editForm.ShowDialog();
             if (result == DialogResult.OK)
             {
                 table.Museums[index] = editForm.Result;
             }
         }
     }
 }