private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Insert) //tambah
            {
                VLapW.frmKoliToneUpdate ifrmChild = new VLapW.frmKoliToneUpdate(this);
                ifrmChild.MdiParent = Program.MainForm;
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.Show();
            }
            else if (e.KeyCode == Keys.End) //edit
            {
                if (dataGridView1.SelectedCells.Count > 0)
                {
                    Guid rowID = (Guid)dataGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    VLapW.frmKoliToneUpdate ifrmChild = new VLapW.frmKoliToneUpdate(this, rowID);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                else
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                }
            }
            else if (e.KeyCode == Keys.Delete)//delete
            {
                if (dataGridView1.SelectedCells.Count > 0)
                {
                    if (MessageBox.Show("Hapus record ini?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Guid rowID = (Guid)dataGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        try
                        {
                            using (Database db = new Database())
                            {
                                DataTable dt = new DataTable();
                                db.Commands.Add(db.CreateCommand("usp_KoliTone_DELETE"));
                                db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, rowID));
                                dt = db.Commands[0].ExecuteDataTable();
                            }

                            MessageBox.Show("Record telah dihapus");
                            this.RefreshData();
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                }
            }
            else
            {
                this.Show();
            }
        }
 private void cmdAdd_Click(object sender, EventArgs e)
 {
     if (dataGridView1.RowCount > 0)
     {
         VLapW.frmKoliToneUpdate ifrmChild = new VLapW.frmKoliToneUpdate(this);
         ifrmChild.MdiParent = Program.MainForm;
         Program.MainForm.RegisterChild(ifrmChild);
         ifrmChild.Show();
     }
 }
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedCells.Count > 0)
     {
         Guid rowID = (Guid)dataGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
         VLapW.frmKoliToneUpdate ifrmChild = new VLapW.frmKoliToneUpdate(this, rowID);
         ifrmChild.MdiParent = Program.MainForm;
         Program.MainForm.RegisterChild(ifrmChild);
         ifrmChild.Show();
     }
     else
     {
         MessageBox.Show(Messages.Error.RowNotSelected);
     }
 }