コード例 #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     using (formAddEditContact formAddEditContact = new formAddEditContact(null))
     {
         if (formAddEditContact.ShowDialog() == DialogResult.OK)
         {
             contactBindingSource.DataSource = contactEntities.Contacts.ToList();
         }
     }
 }
コード例 #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (contactBindingSource.Current == null)
            {
                return;
            }

            using (formAddEditContact formAddEditContact = new formAddEditContact(contactBindingSource.Current as Contact))
            {
                if (formAddEditContact.ShowDialog() == DialogResult.OK)
                {
                    contactBindingSource.DataSource = contactEntities.Contacts.ToList();
                }
            }
        }