private void button9_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count > 0) { int rowIndex = dataGridView1.CurrentCell.RowIndex; if (dataGridView1.Rows[rowIndex].Cells[2].Value.ToString() != "Admin") { createorupdate.itemid = dataGridView1.Rows[rowIndex].Cells[0].Value.ToString(); createorupdate.status = "update"; if (Application.OpenForms.OfType <NuevoUser>().Count() == 1) { Application.OpenForms.OfType <NuevoUser>().First().Focus(); } else { NuevoUser frm = new NuevoUser(); frm.Show(); } } else { MessageBox.Show("Este usuario está protegido"); } } else { MessageBox.Show("No hay ningun usuario seleccionado para edición"); } }
private void button1_Click(object sender, EventArgs e) { createorupdate.status = "create"; if (Application.OpenForms.OfType <NuevoUser>().Count() == 1) { Application.OpenForms.OfType <NuevoUser>().First().Focus(); } else { NuevoUser frm = new NuevoUser(); frm.Show(); } }