private void text_prd_quantity_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (text_prd_quantity.Text != string.Empty) { if (order.VerifyProductQte(text_prd_id.Text, Convert.ToInt32(text_prd_quantity.Text)).Rows.Count < 1) { MessageBox.Show("The Input Quantity Not Available !", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); text_prd_quantity.Focus(); text_prd_quantity.SelectionStart = 0; text_prd_quantity.SelectionLength = text_prd_quantity.TextLength; return; } for (int i = 0; i < DGV_PRD_BILL.Rows.Count - 1; i++) { if (DGV_PRD_BILL.Rows[i].Cells[0].Value.ToString() == text_prd_id.Text) { if (MessageBox.Show("Do you want to Edit Quantity the Entered product?", "Edit process", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { MessageBox.Show("Successfully Edited", "Editing process", MessageBoxButtons.OK, MessageBoxIcon.Information); DGV_PRD_BILL.Rows.RemoveAt(DGV_PRD_BILL.Rows[i].Index); } else { MessageBox.Show("Edit Canceled", "Editing Process", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } else { return; } } if (e.KeyCode == Keys.Enter && text_prd_quantity.Text != string.Empty) { text_prd_discounit.Focus(); } }