protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Enter) { if (dataGridView1.CurrentRow == null) { return(true); } int CurIndex = dataGridView1.CurrentRow.Index; fmWarehouseFright wf = new fmWarehouseFright(dataGridView1.CurrentRow.Cells[0].Value.ToString()); wf.ShowDialog(); dataGridView1.CurrentCell = dataGridView1.Rows[CurIndex].Cells[0]; return(true); } if (keyData == Keys.D0) { if (dataGridView1.CurrentRow == null) { return(true); } BalanceWarehouse Warehouse = new BalanceWarehouse(); Warehouse.UseDefaultCredentials = true; try { Warehouse.WSPrintWarehouseShipment(dataGridView1.CurrentRow.Cells[0].Value.ToString()); } catch (Exception ex) { MessageBoxExample.MyMessageBox.ShowBox(ex.Message); } return(true); } if (keyData == Keys.Escape) { this.Close(); } return(true); }