Ejemplo n.º 1
0
 private void buttonEliminar_Click(object sender, EventArgs e)
 {
     if (dataGridViewActividades.SelectedRows.Count > 0)
     {
         Actividad a      = (Actividad)dataGridViewActividades.SelectedRows[0].DataBoundItem;
         String    nombre = a.nombre;
         if (Utilitats.eliminarForm(sender, e, nombre))
         {
             Utilitats.actividades.Remove(a);
             dataGridViewActividades.DataSource = Utilitats.actividades;
             dataGridViewActividades.Refresh();
         }
     }
     else
     {
         MessageBox.Show("Selecciona una activitat", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
 private void buttonEliminar_Click(object sender, EventArgs e)
 {
     if (dataGridViewLibrerias.SelectedRows.Count > 0)
     {
         Libreria l      = (Libreria)dataGridViewLibrerias.SelectedRows[0].DataBoundItem;
         String   nombre = l.nombre;
         if (Utilitats.eliminarForm(sender, e, nombre))
         {
             Utilitats.librerias.Remove(l);
             dataGridViewLibrerias.DataSource = Utilitats.librerias;
             dataGridViewLibrerias.Refresh();
         }
     }
     else
     {
         MessageBox.Show("Selecciona una llibreria", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Ejemplo n.º 3
0
        /**
         * FORMUSUARIOS_FORMCLOSING: AL CLICKAR LA PESTAÑA DE CERRAR NOS APARECERÁ UN CUADRO DIALOGO
         * PREGUNTANDO SI SALIR SIN GUARDAR CANCELAR O SEGUIR
         **/


        /**
         * BUTTONELIMINAR_CLICK: AL CLICKAR NOS ELIMINA UN USUARIO SELECCIONADO DE LA GRIDVIEW
         * SI NO SELECCIONAMOS NINGUNO NOS SALTA MENSAJE DE ERROR
         **/
        private void buttonEliminar_Click(object sender, EventArgs e)
        {
            if (dataGridViewUsuarios.SelectedRows.Count > 0)
            {
                Usuario user     = (Usuario)dataGridViewUsuarios.SelectedRows[0].DataBoundItem;
                String  username = user.username;
                if (Utilitats.eliminarForm(sender, e, username))
                {
                    Utilitats.usuarios.Remove(user);
                    dataGridViewUsuarios.DataSource = Utilitats.usuarios;
                    dataGridViewUsuarios.Refresh();
                }
            }
            else
            {
                MessageBox.Show("Selecciona un usuario", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }