private void button2_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { if (MessageBox.Show("¿Eliminar?", "Confirmación", MessageBoxButtons.YesNo) == DialogResult.Yes) { string resp = ""; ClassCliente lgTipo = new ClassCliente(); resp = lgTipo.EliminarCliente(Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value.ToString())); MessageBox.Show(resp); ClassCliente lg = new ClassCliente(); { this.dataGridView1.DataSource = lg.ListarCliente(); this.dataGridView1.Refresh(); } } else { //tus codigos } } else { MessageBox.Show("Debe seleccionar una fila"); } }
private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text != "") { dataGridView1.CurrentCell = null; foreach (DataGridViewRow r in dataGridView1.Rows) { r.Visible = false; } foreach (DataGridViewRow r in dataGridView1.Rows) { foreach (DataGridViewCell c in r.Cells) { if ((c.Value.ToString().ToUpper()).IndexOf(textBox1.Text.ToUpper()) == 0) { r.Visible = true; break; } } } } else { ClassCliente lg = new ClassCliente(); { this.dataGridView1.DataSource = lg.ListarCliente(); this.dataGridView1.Refresh(); } } }
private void form2_FormClosed(object sender, FormClosedEventArgs e) { ClassCliente lg = new ClassCliente(); { this.dataGridView1.DataSource = lg.ListarCliente(); this.dataGridView1.Refresh(); } }
private void FormListarCliente_Load(object sender, EventArgs e) { ClassCliente lg = new ClassCliente(); { this.dataGridView1.DataSource = lg.ListarCliente(); this.dataGridView1.Refresh(); } }
private void FormBuscarCliente_Load(object sender, EventArgs e) { ClassCliente lg = new ClassCliente(); { this.dataGridView1.DataSource = lg.ListarCliente(); this.dataGridView1.Refresh(); } label1.Visible = false; }