コード例 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;


            //use index in your gridView
            if (e.ColumnIndex == 0)
            {
                Rol rolAEliminar = (Rol)dataGridView1.CurrentRow.DataBoundItem;
                rolService.eliminar(rolAEliminar);
                cargarRoles();
            }
            else if (e.ColumnIndex == 1)
            {
                Rol rolAEditar = (Rol)dataGridView1.CurrentRow.DataBoundItem;
                rolAEditar = rolService.GetById(rolAEditar.id);
                ModificacionRolViewForm form = new ModificacionRolViewForm(rolAEditar,
                                                                           new FuncionalidadService(new FuncionalidadDao()), rolService);
                this.Hide();
                form.Show();
            }
        }