private void button2_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(comboBox1.Text) == false) { dataGridView1.DataSource = DALCadastro.ListaLog(comboBox1.Text); } }
private void button2_Click(object sender, EventArgs e) { string teste = ""; if (checkBox3.Checked == true) { teste = "sim"; } if (checkBox3.Checked == false) { teste = "não"; } DataTable temp = DALCadastro.TestaConfiVazia("2"); if (temp.Rows.Count < 1) { DALCadastro.CriaConfig("2", "um", "dois", "tres", "quatro", "cinco", "seis", "sete", "oito", "nove", "dez"); DALCadastro.InsereConfig("2", teste, "dois", "tres", "quatro", "cinco", "seis", "sete", "oito", "nove", "dez"); MessageBox.Show("Configuração salva"); if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim") { Ferramentas.CriaLog("config", "Alterou Configuração de controle de Estoque : " + "Faz controle? (" + teste + ")"); } } else { DALCadastro.InsereConfig("2", teste, "dois", "tres", "quatro", "cinco", "seis", "sete", "oito", "nove", "dez"); MessageBox.Show("Configuração salva"); if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim") { Ferramentas.CriaLog("config", "Alterou Configuração de controle de Estoque : " + "Faz controle? (" + teste + ")"); } } Global.Margem.ConfiguraçãoSistemaEstoque = teste; }
private void VisualizaFiado_Load(object sender, EventArgs e) { this.Text += " Cliente : " + Global.Margem.ClienteFiado; comboBox1.Text = "dinheiro"; dataGridView1.DataSource = DALCadastro.FluxoVendaFiado(Global.Margem.ClienteFiado); textBox3.Text = "0,00"; textBox1.Text = "0,00"; textBox2.Text = "0,00"; DataTable parcial = DALCadastro.ListaParcial(Global.Margem.ClienteFiado); if (parcial.Rows.Count > 0) { decimal so = 0; for (int i = 0; i < parcial.Rows.Count; i++) { so = so + Convert.ToDecimal(Convert.ToDecimal(parcial.Rows[i]["Total_Devedor"].ToString()) - Convert.ToDecimal(parcial.Rows[i]["Valor_Parcial"].ToString())); } textBox1.Text = Convert.ToString(so); if (dataGridView1.Rows.Count <= 0) { textBox3.Text = textBox1.Text; textBox2.Text = "0,00"; } } if (dataGridView1.Rows.Count > 0) { decimal soma = 0; for (int i = 0; i < dataGridView1.Rows.Count; i++) { soma = soma + Convert.ToDecimal(dataGridView1.Rows[i].Cells[5].Value); } textBox2.Text = Convert.ToString(soma); textBox3.Text = Convert.ToString(soma + Convert.ToDecimal(textBox1.Text)); } }
private void checkBox2_CheckedChanged(object sender, EventArgs e) { if (checkBox2.Checked == true) { if (dataGridView2.Rows.Count > 0) { string temp = dataGridView2.Rows[dataGridView2.SelectedCells[0].RowIndex].Cells[0].FormattedValue.ToString(); string ativ = "sim"; DALCadastro.Inativa_Contas_Corrente(temp, ativ); MessageBox.Show("Conta Ativa"); dataGridView2.DataSource = DALCadastro.Lista_Contas_Corrente("0"); } } if (checkBox2.Checked == false) { if (dataGridView2.Rows.Count > 0) { string temp = dataGridView2.Rows[dataGridView2.SelectedCells[0].RowIndex].Cells[0].FormattedValue.ToString(); string ativ = "não"; DALCadastro.Inativa_Contas_Corrente(temp, ativ); MessageBox.Show("Conta Inativa"); dataGridView2.DataSource = DALCadastro.Lista_Contas_Corrente("0"); } } }
private void pictureBox8_Click(object sender, EventArgs e) { if (Global.Margem.ConfiguraçãoSistema != "adm") { MessageBox.Show("Acesso não autorizado"); return; } if (String.IsNullOrEmpty(textBox1.Text) == false && String.IsNullOrEmpty(textBox2.Text) == false) { string temp = ""; if (checkBox1.Checked == true) { temp = "sim"; } if (checkBox1.Checked == false) { temp = "não"; } DALCadastro.Insere_Banco(textBox1.Text, textBox2.Text, temp); MessageBox.Show("Banco incluído com sucesso"); if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim") { Ferramentas.CriaLog("config", "Incluiu novo Banco : " + "Código : " + textBox1.Text + " Nome : " + textBox2.Text); } textBox1.ReadOnly = true; textBox2.ReadOnly = true; textBox1.Text = ""; textBox2.Text = ""; checkBox1.Visible = false; } }
private void button1_Click(object sender, EventArgs e) { if (Global.Margem.ConfiguraçãoSistema != "adm") { MessageBox.Show("Acesso não autorizado"); return; } DataTable temp = DALCadastro.TestaConfiVazia("1"); if (temp.Rows.Count < 1) { DALCadastro.CriaConfig("1", "um", "dois", "tres", "quatro", "cinco", "seis", "sete", "oito", "nove", "dez"); DALCadastro.InsereConfig("1", textBox9.Text, textBox10.Text, textBox11.Text, "quatro", "cinco", "seis", "sete", "oito", "nove", "dez"); MessageBox.Show("Configuração salva"); if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim") { Ferramentas.CriaLog("config", "Salvou margem, impostos, comissão : " + textBox9.Text + " / " + textBox10.Text + " / " + textBox11.Text); } } else { DALCadastro.InsereConfig("1", textBox9.Text, textBox10.Text, textBox11.Text, "quatro", "cinco", "seis", "sete", "oito", "nove", "dez"); MessageBox.Show("Configuração salva"); if (Global.Margem.ConfiguraçãoSistemaLOGs == "sim") { Ferramentas.CriaLog("config", "Salvou margem, impostos, comissão : " + textBox9.Text + " / " + textBox10.Text + " / " + textBox11.Text); } } Global.Margem.ConfiguraçãoSistemaFinanceiroMargem = textBox9.Text; Global.Margem.ConfiguraçãoSistemaFinanceiroImpostos = textBox10.Text; Global.Margem.ConfiguraçãoSistemaFinanceiroComissão = textBox11.Text; }
private void FecharCaixa_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F1) { string ret = ""; //abrir retiradas DataTable retirada = DALCadastro.ListaRetirada(Global.Margem.RetiradaCaixa); if (retirada.Rows.Count > 0) { for (int i = 0; i < retirada.Rows.Count; i++) { ret += retirada.Rows[i]["Valor"].ToString() + " ==> " + retirada.Rows[i]["Motivo"].ToString() + " ==> " + retirada.Rows[i]["Caixa"].ToString() + "\n"; } MessageBox.Show(ret); } if (retirada.Rows.Count <= 0) { MessageBox.Show("Não houve retiradas do caixa."); } } if (e.KeyCode == Keys.Escape) { Global.Margem.Cancelar = "OK"; this.Close(); } if (e.KeyCode == Keys.F2) { Form detalhes = new ParcialList(); detalhes.ShowDialog(); } }
private void ContasReceberNovo_Load(object sender, EventArgs e) { if (Global.Margem.CadastroContasReceber == "salvar") { textBox3.Text = DateTime.Now.Date.ToShortDateString(); comboBox1.Text = "Boleto Bancário"; comboBox2.Text = "DM - Mercantil"; textBox1.Text = Convert.ToString(DALCadastro.Numero_Titulo()); textBox2.Text = "1"; } if (Global.Margem.CadastroContasReceber == "baixar") { checkBox3.Visible = true; tabControl1.SelectedTab = tabPage2; tabControl2.SelectedTab = tabPage3; tabPage3.Focus(); textBox23.Text = DateTime.Now.Date.ToShortDateString(); string indet = Global.Margem.IdContasReceber; BaixarContaReceber(DALCadastro.Baixa_Contas_Receber(indet)); if (Convert.ToDouble(textBox18.Text) > 0) { checkBox3.Visible = false; } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.ReadOnly == false && String.IsNullOrEmpty(textBox1.Text)) { bool jaexiste = false; bool controle = false; if (dataGridView1.Rows.Count > 0) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (controle == false) { if (textBox1.Text == dataGridView1.Rows[i].Cells[1].Value.ToString()) { MessageBox.Show("Já existe este cadastro!"); jaexiste = true; } } } } if (jaexiste == false) { string Stored = "CriarCadModelo"; DALCadastro.AUXCadCriar(Stored, textBox1.Text); dataGridView1.DataSource = DALCadastro.AUXCadListar("ListarCadModelo"); textBox1.ReadOnly = true; textBox1.Text = ""; label3.Text = ""; } } }
private void button5_Click(object sender, EventArgs e) { DataTable cor = DALCadastro.CoresRetorna(Global.Margem.Operador); if (cor.Rows.Count <= 0) { int cor1 = Convert.ToInt32(pictureBox1.BackColor.ToArgb()); int cor2 = Convert.ToInt32(pictureBox2.BackColor.ToArgb()); int cor3 = Convert.ToInt32(pictureBox3.BackColor.ToArgb()); int cor4 = Convert.ToInt32(pictureBox4.BackColor.ToArgb()); int cor5 = Convert.ToInt32(pictureBox8.BackColor.ToArgb()); DALCadastro.OperadorCoresInsere(Global.Margem.Operador, Convert.ToString(cor1), Convert.ToString(cor2), Convert.ToString(cor3), Convert.ToString(cor4), Convert.ToString(cor5)); MessageBox.Show("Aparência alterada com sucesso!"); } if (cor.Rows.Count > 0) { int cor1 = Convert.ToInt32(pictureBox1.BackColor.ToArgb()); int cor2 = Convert.ToInt32(pictureBox2.BackColor.ToArgb()); int cor3 = Convert.ToInt32(pictureBox3.BackColor.ToArgb()); int cor4 = Convert.ToInt32(pictureBox4.BackColor.ToArgb()); int cor5 = Convert.ToInt32(pictureBox8.BackColor.ToArgb()); DALCadastro.OperadorCores(Global.Margem.Operador, Convert.ToString(cor1), Convert.ToString(cor2), Convert.ToString(cor3), Convert.ToString(cor4), Convert.ToString(cor5)); MessageBox.Show("Aparência alterada com sucesso!"); } }
private void button2_Click(object sender, EventArgs e) { Form cadRapido = new CadastroProdRapido(); cadRapido.ShowDialog(); if (Global.Margem.CadRapido == "EAN") { dataGridView1.DataSource = DALCadastro.ProcurarProdutoCodeBar(Global.Margem.EANCadRapido); textBox3.Text = dataGridView1.Rows[0].Cells[1].Value.ToString(); textBox3.Focus(); } if (Global.Margem.CadRapido == "SemEAN") { dataGridView1.DataSource = DALCadastro.ProcurarProdutoSemCodeBarId(Global.Margem.IDCadRapido); textBox3.Text = dataGridView1.Rows[0].Cells[1].Value.ToString(); textBox3.Focus(); } Global.Margem.CadRapido = ""; Global.Margem.EANCadRapido = ""; Global.Margem.IDCadRapido = ""; if (dataGridView1.Rows.Count > 0) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { dataGridView1.Columns[1].Width = 330; textBox3.Text = dataGridView1.Rows[0].Cells[1].Value.ToString(); textBox3.Focus(); } //dataGridView1.Focus(); } }
private void textBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { if (String.IsNullOrEmpty(textBox2.Text) == false) { dataGridView1.DataSource = DALCadastro.ProcurarProdutoSemCodeBarDescInt("%" + textBox2.Text + "%"); if (dataGridView1.Rows.Count > 0) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { dataGridView1.Columns[1].Width = 330; //textBox3.Text = dataGridView1.Rows[0].Cells[1].Value.ToString(); textBox3.Focus(); } } if (dataGridView1.Rows.Count <= 0) { MessageBox.Show("Produto inexistente"); textBox2.Text = ""; textBox2.Focus(); } } button1.Focus(); } }
private void pictureBox5_Click(object sender, EventArgs e) { Form cadFiado = new ClienteFiado(); cadFiado.ShowDialog(); dataGridView1.DataSource = DALCadastro.ListaClienteFiado(); }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox1.Text) == true) { dataGridView1.DataSource = DALCadastro.Lista_Contas_Recebe_Tudor(); } }
protected void CarregaDados() { DataTable oDt = new DataTable(); Conexao oConnect = new Conexao(strConexao); DALCadastro oConsulta = new DALCadastro(oConnect); if (_Ini == null) { _Ini = 1; } if (_Fin == null) { _Fin = 99999999; } var lista = oConsulta.Pesquisar(_Ini, _Fin); if (lista != null && lista.Rows.Count > 0) { this.gvCadastro.DataSource = lista; this.gvCadastro.DataBind(); } else { this.msg = "Nenhum registro encontrado."; ClientScript.RegisterClientScriptBlock(this.GetType(), "Mensagem", "alert('" + msg + "'); ", true); } }
private void ClienteFiado_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (String.IsNullOrEmpty(textBox12.Text) == false) { // textBox12.Text = Ferramentas.Retira_Meta(textBox12.Text); DataTable cli = DALCadastro.VerificaParticipanteFiado(textBox12.Text, "Ativo"); if (cli.Rows.Count <= 0) { DALCadastro.CadClienteFiado(textBox12.Text, textBox19.Text, textBox22.Text, textBox7.Text, textBox27.Text, textBox26.Text); this.Close(); } if (cli.Rows.Count > 0) { MessageBox.Show("Cadastro já existente"); dataGridView1.DataSource = cli; } } } if (e.KeyCode == Keys.F5) { if (String.IsNullOrEmpty(textBox12.Text) == false) { //textBox12.Text = Ferramentas.Retira_Meta(textBox12.Text); dataGridView1.DataSource = DALCadastro.VerificaParticipanteFiado(textBox12.Text, "Ativo"); } } if (e.KeyCode == Keys.Escape) { this.Close(); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.ReadOnly == true && textBox2.ReadOnly == true) { MessageBox.Show("Necessário abrir novo cadastro."); return; } if (String.IsNullOrEmpty(textBox1.Text) == false && String.IsNullOrEmpty(textBox2.Text) == false) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (textBox2.Text == dataGridView1.Rows[i].Cells[0].Value.ToString()) { MessageBox.Show("Código já cadastrado."); return; } } DALCadastro.CriaCFOP(textBox2.Text, textBox1.Text); MessageBox.Show("CFOP inserido com sucesso."); dataGridView1.DataSource = DALCadastro.ListaCFOP(); textBox1.ReadOnly = true; textBox2.ReadOnly = true; } else { MessageBox.Show("Campos Obrigatórios não preenchidos."); } }
private void button3_Click(object sender, EventArgs e) { if (textBox2.ReadOnly == true && textBox1.ReadOnly == true) { if (String.IsNullOrEmpty(textBox1.Text) == false && String.IsNullOrEmpty(textBox2.Text) == false) { DataTable pode = DALCadastro.PodeApagarCFOP(textBox2.Text); if (pode.Rows.Count <= 0) { DALCadastro.ProcCFOP(textBox2.Text); MessageBox.Show("CFOP apagado com sucesso."); dataGridView1.DataSource = DALCadastro.ListaCFOP(); } if (pode.Rows.Count > 0) { MessageBox.Show("CFOP não pode ser deletado, pois já foi utilizado para cadastrar produtos."); } //deleta } } if (textBox2.ReadOnly == false && textBox1.ReadOnly == false) { MessageBox.Show("Selecionar antes o código CFOP"); } }
private void Avisos_Load(object sender, EventArgs e) { string dia = DateTime.Now.Day.ToString(); if (dia.Length == 1) { dia = "0" + dia; } string mes = DateTime.Now.Month.ToString(); if (mes.Length == 1) { mes = "0" + mes; } string ano = DateTime.Now.Year.ToString(); int compara = Convert.ToInt32(ano + mes + dia); DataTable list = DALCadastro.ListaEventos(); if (list.Rows.Count > 0) { for (int i = 0; i < list.Rows.Count; i++) { int temp = Convert.ToInt32(list.Rows[i]["DataGatilho"].ToString()); if (temp <= compara) { richTextBox1.Text += "# Produto || " + list.Rows[i]["Descrição"].ToString() + " || " + list.Rows[i]["Qtde"].ToString() + "\n"; } } } }
protected void Excluir() { Conexao c = new Conexao(strConexao); DALCadastro d = new DALCadastro(c); Cadastro ctt = new Cadastro(); try { if (hOperacao.Value != "D") { hOperacao.Value = "D"; habilitarBtn(false, true, false, false, true, false); } else { d.Excluir(Convert.ToInt32(hCodigo.Value)); Limpar(); CarregaDados(); mostrarPainel(true, true, false); } } catch { } }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox2.Text) == false && String.IsNullOrEmpty(textBox3.Text) == false) { if (textBox2.Text == textBox3.Text) { if (textBox2.Text != textBox1.Text) { //alterar senha DALCadastro.UserSenhaEdita(Convert.ToInt32(Global.Margem.intCadUsr), textBox2.Text); Global.Margem.editaUsrSist = "ok"; this.Close(); } else { MessageBox.Show("Repetição da nova senha não confere, \nou nova senha é igual à senha anterior"); textBox3.Text = ""; textBox3.Focus(); return; } } } else { MessageBox.Show("Campo(s) não preenchido(s)"); return; } }
private void AlteraSenha_Load(object sender, EventArgs e) { label3.Text = Global.Margem.OperadorTemp; textBox1.Text = Convert.ToString(DALCadastro.carregaPermissao("CarregaSenha", Convert.ToInt32(Global.Margem.intCadUsr))); textBox2.Text = ""; textBox2.Focus(); }
private void UsuariosSistema_Load(object sender, EventArgs e) { DataTable cor = DALCadastro.CoresRetorna(Global.Margem.Operador); this.Text += " ==> Operador: " + Global.Margem.Operador; DataTable cor10 = DALCadastro.CoresRetorna(Global.Margem.Operador); if (cor10.Rows.Count > 0) { panel1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["CorMenu"].ToString())); panel2.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor2"].ToString())); } else { DataTable cor2 = DALCadastro.CoresRetorna("Default"); if (cor2.Rows.Count > 0) { panel1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["CorMenu"].ToString())); panel2.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor2"].ToString())); } } dataGridView1.DataSource = DALCadastro.ListaUsrSistemaEdita(); textBox1.Focus(); }
private void button6_Click(object sender, EventArgs e) { string def = "Default"; DataTable cor = DALCadastro.CoresRetorna(def); if (cor.Rows.Count > 0) { panel2.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["CorMenu"].ToString())); pictureBox1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["CorMenu"].ToString())); panel3.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor2"].ToString())); pictureBox2.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor2"].ToString())); tabPage1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor3"].ToString())); tabPage2.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor3"].ToString())); pictureBox3.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor3"].ToString())); panel4.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor4"].ToString())); pictureBox4.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor4"].ToString())); panel6.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor5"].ToString())); pictureBox8.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(cor.Rows[0]["Cor5"].ToString())); MessageBox.Show("Aparência original restaurada"); return; } if (cor.Rows.Count <= 0) { int cor1 = Convert.ToInt32(pictureBox1.BackColor.ToArgb()); int cor2 = Convert.ToInt32(pictureBox2.BackColor.ToArgb()); int cor3 = Convert.ToInt32(pictureBox3.BackColor.ToArgb()); int cor4 = Convert.ToInt32(pictureBox4.BackColor.ToArgb()); int cor5 = Convert.ToInt32(pictureBox8.BackColor.ToArgb()); DALCadastro.OperadorCoresInsere(def, Convert.ToString(cor1), Convert.ToString(cor2), Convert.ToString(cor3), Convert.ToString(cor4), Convert.ToString(cor5)); MessageBox.Show("Aparência original restaurada"); } }
private void button2_Click(object sender, EventArgs e) { string message = "Você deseja excluír o código vinculado da balança -> " + textBox2.Text + " ?"; string caption = "Exclusão Preço/KG alternativo"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { if (textBox2.ReadOnly == true && String.IsNullOrEmpty(textBox1.Text) == false && String.IsNullOrEmpty(textBox2.Text) == false && String.IsNullOrEmpty(textBox3.Text) == false) { DALCadastro.ExcluiFracionadoAlternativo(textBox2.Text); dataGridView1.DataSource = DALCadastro.FracionadoAlternativo(codigo); MessageBox.Show("Código : " + textBox2.Text + " excluído com sucesso."); label5.Text = ""; textBox1.ReadOnly = true; textBox3.ReadOnly = true; textBox2.ReadOnly = true; textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; } } }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox12.Text) == false) { //textBox12.Text = Ferramentas.Retira_Meta(textBox12.Text); dataGridView1.DataSource = DALCadastro.VerificaParticipanteFiado(textBox12.Text, "Ativo"); } }
private void textBox1_TextChanged(object sender, EventArgs e) { if (checkBox1.Checked == true) { textBox1.Text = Ferramentas.Retira_Meta(textBox1.Text); string sum = textBox1.Text + "%"; dataGridView1.DataSource = DALCadastro.VerificaParticipante2(sum); } }
private void pictureBox3_Click(object sender, EventArgs e) { Form formPrincipal = new TelaPrincipal(); DataTable cor = DALCadastro.CoresRetorna(Global.Margem.Operador); GerenciadorDeFormulario.Abre(formPrincipal); GerenciadorDeFormulario.Fecha(this); }
private void CadastroProdRapido_Load(object sender, EventArgs e) { comboBox5.DataSource = DALCadastro.AUXCadListar("ListarCadUnidade"); comboBox5.ValueMember = "Descrição"; comboBox5.DisplayMember = "Descricao"; comboBox5.SelectedItem = ""; comboBox5.Refresh(); Global.Margem.IDCadRapido = Convert.ToString(DALCadastro.Revisao()); textBox1.Focus(); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows.Count > 0) { label3.Text = dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].FormattedValue.ToString(); if (String.IsNullOrEmpty(dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[5].FormattedValue.ToString()) == false) { dataGridView2.DataSource = DALCadastro.FracionadoAlternativo(dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[5].FormattedValue.ToString()); } } }