private void btnICliente_Click(object sender, EventArgs e) { frmCCliente ofrmCCliente = new frmCCliente(); ofrmCCliente.ShowDialog(); CarregarGrid(); CarregarGridTel(); }
private void button2_Click(object sender, EventArgs e) { if (grdCliente.SelectedCells.Count != 0) { frmCCliente ofrmCCliente = new frmCCliente(); if (Convert.ToBoolean(grdCliente.SelectedCells[11].Value)) { ofrmCCliente.rdbPF.Checked = true; } else { ofrmCCliente.rdbPJ.Checked = true; } if (ofrmCCliente.rdbPF.Checked) { ofrmCCliente.txtCPF.Text = grdCliente.SelectedCells[1].Value.ToString(); } else { ofrmCCliente.txtCNPJ.Text = grdCliente.SelectedCells[2].Value.ToString(); } oCliente.intCodigo = Convert.ToInt32(grdCliente.SelectedCells[0].Value); ofrmCCliente.txtNome.Text = grdCliente.SelectedCells[3].Value.ToString(); ofrmCCliente.txtCEP.Text = grdCliente.SelectedCells[4].Value.ToString(); ofrmCCliente.txtEndereco.Text = grdCliente.SelectedCells[5].Value.ToString(); ofrmCCliente.txtNumero.Text = grdCliente.SelectedCells[6].Value.ToString(); ofrmCCliente.txtComplemento.Text = grdCliente.SelectedCells[7].Value.ToString(); ofrmCCliente.txtBairro.Text = grdCliente.SelectedCells[8].Value.ToString(); ofrmCCliente.txtCidade.Text = grdCliente.SelectedCells[9].Value.ToString(); ofrmCCliente.txtUF.Text = grdCliente.SelectedCells[10].Value.ToString(); oCliente.ConsultarTel(); ofrmCCliente.txtCodigo.Text = oCliente.intCodigo.ToString(); foreach (string tel in oCliente.strTelefones) { ofrmCCliente.lstTelefones.Items.Add(tel); } ofrmCCliente.ShowDialog(); oCliente = null; oCliente = new Cliente(); CarregarGrid(); } }