private void btnBuscar_Click(object sender, EventArgs e) { Funcionario fun = new Funcionario(); FuncionarioBO funcionarioBO = new FuncionarioBO(); try { fun.Cod = Convert.ToInt16(txtCod.Text); funcionarioBO.BuscaPorCod(fun); if (fun.Nome == "") { MessageBox.Show("Funcionario não encontrado!"); } else { txtCod.Text = Convert.ToString(fun.Cod); txtNome.Text = fun.Nome; txtCPF.Text = Convert.ToString(fun.Cpf); mskCep.Text = fun.Cep; txtEndereco.Text = fun.Endereco; txtNumero.Text = fun.Numero; txtCidade.Text = fun.Cidade; txtTelefone.Text = fun.Telefone; txtCartTrab.Text = fun.CartTrab; txtSalario.Text = Convert.ToString(fun.Salario); } } catch { MessageBox.Show("Preencha corretamente as informações!!"); } }