private void textboxCustomerSearchName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { if (dataGridViewListCustomer.SelectedRows.Count == 1) { string phoneNumber = dataGridViewListCustomer.SelectedRows[0].Cells[2].Value.ToString(); if (phoneNumber != "") { tbxSearchTopup.Text = phoneNumber; phoneNumber = phoneNumber.Replace("_", "").Replace("-", "").Replace("_", "").Trim(); if (phoneNumber.Length > 2) { getListPhoneNumber(false, phoneNumber); } FRMCustomerTopup cutTopup = new FRMCustomerTopup(this); cutTopup.ShowDialog(); } } } else if (e.KeyCode == Keys.Escape) { textboxCustomerSearchName.Text = ""; } else if (e.KeyCode == Keys.Down) { int iRows = dataGridViewListCustomer.Rows.Count; if (iRows > 0) { //int iColumn = dataGridViewListCustomer.CurrentCell.ColumnIndex; int iRow = dataGridViewListCustomer.CurrentCell.RowIndex; if (iRow+1 < iRows) dataGridViewListCustomer.Rows[iRow + 1].Cells[1].Selected = true; } } else if (e.KeyCode == Keys.Up) { int iRows = dataGridViewListCustomer.Rows.Count; if (iRows > 0) { //int iColumn = dataGridViewListCustomer.CurrentCell.ColumnIndex; int iRow = dataGridViewListCustomer.CurrentCell.RowIndex; if (iRow > 0) dataGridViewListCustomer.Rows[iRow - 1].Cells[1].Selected = true; } e.Handled = false; } }
private void textboxCustomerSearchPhone_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { if (dataGridViewListCustomer.SelectedRows.Count == 1) { string phoneNumber = dataGridViewListCustomer.SelectedRows[0].Cells[2].Value.ToString(); if (phoneNumber != "") { tbxSearchTopup.Text = phoneNumber; phoneNumber = phoneNumber.Replace("_", "").Replace("-", "").Replace("_", "").Trim(); if (phoneNumber.Length > 2) { getListPhoneNumber(false, phoneNumber); } FRMCustomerTopup cutTopup = new FRMCustomerTopup(this); cutTopup.ShowDialog(); } } } else if (e.KeyCode == Keys.Escape) { textboxCustomerSearchPhone.Text = ""; } }
private void dataGridViewListCustomer_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dataGridViewListCustomer.SelectedRows.Count == 1) { string phoneNumber = dataGridViewListCustomer.SelectedRows[0].Cells[2].Value.ToString(); if (phoneNumber != "") { tbxSearchTopup.Text = phoneNumber; phoneNumber = phoneNumber.Replace("_", "").Replace("-", "").Replace("_", "").Trim(); if (phoneNumber.Length > 2) { getListPhoneNumber(false, phoneNumber); } FRMCustomerTopup cutTopup = new FRMCustomerTopup(this); cutTopup.ShowDialog(); } } }