private void buttonNuevo_Click(object sender, EventArgs e) { EditCreateForm Guardar = new EditCreateForm(); Guardar.ShowDialog(); dataGridViewCategorias.Rows.Clear(); LlenaCampos(); }
private void buttonEditar_Click(object sender, EventArgs e) { if (dataGridViewCategorias.SelectedRows.Count > 0) { EditCreateForm editar = new EditCreateForm(); editar.Nombre = dataGridViewCategorias.CurrentRow.Cells["ColumnNombre"].Value.ToString(); editar.Id = (int)dataGridViewCategorias.CurrentRow.Cells["ColumnIdCategorias"].Value; editar.Descripcion = dataGridViewCategorias.CurrentRow.Cells["ColumnDescripcion"].Value.ToString(); editar.ShowDialog(); dataGridViewCategorias.Rows.Clear(); LlenaCampos(); } else { MessageBox.Show("Por favor selecione una fila!"); } }