private void btnEditar_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { FormRegistroMarca m = new FormRegistroMarca(); m.txtCodigoMarca.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); m.txtNombreMarca.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); m.txtDescriptionMarca.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); if (dataGridView1.SelectedRows.Count > 0) { Program.Evento = 1; } else { Program.Evento = 0; } m.ShowDialog(); CargarListado(); dataGridView1.ClearSelection(); } else { MessageBox.Show("Debe Seleccionar la Fila a Editar.", "Sistema de Ventas.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnNuevo_Click(object sender, EventArgs e) { FormRegistroMarca mr = new FormRegistroMarca(); if (dataGridView1.SelectedRows.Count > 0) { Program.Evento = 1; } else { Program.Evento = 0; } dataGridView1.ClearSelection(); mr.ShowDialog(); }