private void BtnDeletar_Click_1(object sender, EventArgs e) { if (TxtCodCliente.Text == "") { MessageBox.Show("Favor Digitar Código Cliente!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { conn.Open(); SqlCommand comando = new SqlCommand(@"DELETE FROM CLIENTES where (Id_Cliente='" + TxtCodCliente.Text + "')", conn) { CommandType = CommandType.Text }; comando.ExecuteNonQuery(); TxtCodCliente.Clear(); MessageBox.Show("Cliente Excluído com Sucesso!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("Erro ao Excluir Cliente", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); } } conn.Close(); LimpaDados(); BtnCadastrar.Enabled = true; BtnAlterar.Enabled = false; BtnDeletar.Enabled = false; TxtCodCliente.Enabled = false; TxtNome.Focus(); }
public void LimpaVenda() { TxtCodVenda.Clear(); TxtNome.Clear(); TxtCodCliente.Clear(); CboFormaPag.Text = "Selecione"; dataGridView1.Rows.Clear(); listBox1.Enabled = false; listBox2.Enabled = false; CboFormaPag.Enabled = false; TxtQtde.Enabled = false; BtnAddProduto.Enabled = false; BtnRemoveItem.Enabled = false; LblValorTotal.Text = ""; listBox1.Items.Clear(); listBox2.Items.Clear(); BtnFimCompra.Enabled = false; }
public void LimpaDados() { TxtCodCliente.Clear(); TxtNome.Clear(); CboSexo.Text = "Selecione"; TxtEndereco.Clear(); TxtBairro.Clear(); TxtCidade.Clear(); MktCep.Clear(); CmbEstado.Text = "Selecione"; MktFoneFixo.Clear(); MkFoneComercial.Clear(); MktCelular.Clear(); TxtRG.Clear(); TxtEmail.Clear(); MktCPF.Clear(); dataNasc.Text = ""; CboCadPor.Text = "Selecione"; CboCadPor.Enabled = true; }