private void Form1_Load(object sender, EventArgs e) { try { Limpiar(); HabDeshCamp(false); toolGuardar.Enabled = false; toolCancelar.Enabled = false; ClassData data = new ClassData(); if (data.IsConnect()) { MessageBox.Show("Conexión Exitosa", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Conexión Fallida", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } dgvUsers.DataSource = data.LoadData(); } catch (Exception ex) { } }
private void toolGuardar_Click(object sender, EventArgs e) { ClassData data = new ClassData(); if (isupdate == true) { data.ActualizaDato(textUsuario.Text, textNickname.Text, textCont.Text, textCorreo.Text, Id); } else { data.InsertaDato(textUsuario.Text, textNickname.Text, textCont.Text, textCorreo.Text); } dgvUsers.DataSource = data.LoadData(); Limpiar(); HabDeshCamp(false); toolAgregar.Enabled = true; toolActualizar.Enabled = true; toolBorrar.Enabled = true; toolGuardar.Enabled = false; toolCancelar.Enabled = false; isupdate = false; this.Refresh(); }
private void toolBorrar_Click(object sender, EventArgs e) { ClassData data = new ClassData(); data.BorrarDato(usuario, Id); Limpiar(); HabDeshCamp(false); toolAgregar.Enabled = true; toolActualizar.Enabled = true; toolBorrar.Enabled = true; toolGuardar.Enabled = false; toolCancelar.Enabled = false; isupdate = false; dgvUsers.DataSource = data.LoadData(); this.Refresh(); }