Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Child obj = childBindingSource.Current as Child;

            if (obj != null)
            {
                using (AddForm frm = new AddForm()
                {
                    ChildInfo = obj
                })
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        childBindingSource.EndEdit();
                    }
                }
            }
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (AddForm frm = new AddForm()
     {
         ChildInfo = new Child()
     })
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (frm.textBox1.Text.Length == 0 | frm.textBox2.Text.Length == 0 | frm.textBox3.Text.Length == 0 | frm.textBox5.Text.Length == 0)
             {
                 MessageBox.Show("Вы не заполнили поля", "Внимание!");
             }
             else
             {
                 childBindingSource.Add(frm.ChildInfo);
             }
         }
     }
 }