public void MostrarTodo(object sender = null, EventArgs e = null) { try { dataGridViewNormal2.DataSource = Usuario.ListadoGeneral(); lblCantidad.Text = "Items: " + dataGridViewNormal2.Rows.Count.ToString(); ControlTextBoxDeBusqueda.Text = ""; ControlTextBoxDeBusqueda.Focus(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void dataGridViewNormal2_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { e.Handled = true; CargarDesdeElGrid(); } else if (e.KeyCode == Keys.Up && dataGridViewNormal2.CurrentRow.Index == 0) { e.Handled = true; ControlTextBoxDeBusqueda.Focus(); } } catch { } }