private void toolStripButton1_Click(object sender, EventArgs e)
        {
            var frm = new Form_Usuarios("");

            frm.CargaListaAllUsu += CargaListaAllUsu;
            frm.ShowDialog();
        }
        private void toolStripButton_Edit_Click(object sender, EventArgs e)
        {
            //Valida que no haya mas de un registro seleccionado
            var contador = 0;

            //Finaliza modo de edicion
            dataGridView1.EndEdit();
            foreach (DataGridViewRow registro in dataGridView1.Rows)
            {
                try
                {
                    if ((Boolean)registro.Cells["Seleccionar"].Value)
                    {
                        contador++;
                    }
                }
                catch
                {
                    // ignored
                }
            }

            if (contador == 0)
            {
                MessageBox.Show(@"Debe seleccionar al menos un registro.");
                return;
            }

            if (contador > 1)
            {
                MessageBox.Show(@"Para editar solo seleccione un registro.");
            }
            else
            {
                foreach (DataGridViewRow registro in dataGridView1.Rows)
                {
                    try
                    {
                        if ((bool)registro.Cells["Seleccionar"].Value != true)
                        {
                            continue;
                        }
                        var id  = registro.Cells[1].Value.ToString();
                        var frm = new Form_Usuarios(id);
                        frm.CargaListaAllUsu += CargaListaAllUsu;
                        frm.ShowDialog();
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
        }
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            var row = dataGridView1.Rows[e.RowIndex];
            var id  = row.Cells["Id"].Value.ToString();
            var frm = new Form_Usuarios(id);

            frm.CargaListaAllUsu += CargaListaAllUsu;
            frm.ShowDialog();
        }
Exemplo n.º 4
0
        private void AgregarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_Usuarios ventana = new Form_Usuarios();

            ventana.Show();
        }