Beispiel #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool         result = true;
            DialogResult dialog = MessageBox.Show("Are you sure you want to delete?", "Cancel Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

            if (dialog == DialogResult.OK)
            {
                foreach (DataGridViewRow item in this.dgvTable.SelectedRows)
                {
                    // KHÔNG XÓA ĐƯỢC?????????
                    // Delete Datagridview
                    //dgvTable.Rows.RemoveAt(item.Index);
                    var itemToDelete = (Table)item.DataBoundItem;
                    if (tableBLL.DeleteTable(itemToDelete.TableID) == false)
                    {
                        result = false;
                        break;
                    }
                }
                if (result == false)
                {
                    MessageBox.Show("Cannot save. Please try again!");
                }
                else
                {
                    MessageBox.Show("Saved successfully!");
                    mainform.loadUCTableEdit();
                }
            }
        }
Beispiel #2
0
 private void btn_Edit_Click(object sender, EventArgs e)
 {
     mainform.loadUCTableEdit();
 }