private void btnCalcular_Click(object sender, EventArgs e) { try { /* Enviar os dados para a classe */ obj.Nome = txtNome.Text; obj.Altura = double.Parse(txtAltura.Text); obj.Idade = int.Parse(txtIdade.Text); obj.Peso = double.Parse(txtPeso.Text); lblIMC.Text = (obj.CalcularIMC().ToString("0.00")); MessageBox.Show(obj.ImprimirDados() + "\nIMC: " + obj.CalcularIMC().ToString("0.00")); } /* Tratamento de exceções */ catch (FormatException ex) { MessageBox.Show("Me desculpe, ocorreu um erro.\n" + ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnCalcular_Click(object sender, EventArgs e) { MessageBox.Show("Dados obtidos: " + obj.ImprimeDados() + "\n\nIdade: " + obj.CalcularIdade().ToString("00") + "\n\nIMC: " + obj.CalcularIMC().ToString("00")); txtIdade.Text = obj.CalcularIdade().ToString(); txtIMC.Text = obj.CalcularIMC().ToString(); }
private void btn_calc_Click(object sender, EventArgs e) { if (txtNome.Text == "" || txtAltura.Text == "" || txtIdade.Text == "" || txtPeso.Text == "") { MessageBox.Show("Dados acima faltando!"); } else { MessageBox.Show("Dados Obtidos: " + obj.ImprimeDados() + "\nIMC: " + obj.CalcularIMC().ToString()); lbl_imc.Text = obj.CalcularIMC().ToString(); } }
private void btn_resultado_Click(object sender, EventArgs e) { double resultado; try { obj.nome = txt_nome.Text; obj.altura = double.Parse(txt_altura.Text); obj.peso = double.Parse(txt_peso.Text); obj.idade = int.Parse(txt_idade.Text); } catch (FormatException ex) { MessageBox.Show("Erro. \n" + ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { resultado = double.Parse(obj.CalcularIMC().ToString("0.00")); MessageBox.Show("O IMC do atleta " + obj.nome + " de " + obj.idade + " anos é " + resultado); } /////git }
private void btn_calc_Click(object sender, EventArgs e) { try { obj.Altura = Double.Parse(txt_altura.Text); obj.Peso = Double.Parse(txt_peso.Text); obj.Nome = txt_altura.Text; } catch (FormatException ex) { MessageBox.Show("Erro. \n" + ex.Message); } catch (Exception ex) { MessageBox.Show("Erro. \n" + ex.Message); } try { MessageBox.Show("Seu Imc é :" + obj.CalcularIMC()); } catch { MessageBox.Show("Algo deu errado :("); } }
private void btnCalcular_Click(object sender, EventArgs e) { try { Arthur.Altura = double.Parse(txtAltura.Text); Arthur.Peso = double.Parse(txtPeso.Text); lblResposta.Text = Arthur.CalcularIMC().ToString(); } catch (FormatException ex) { MessageBox.Show("Erro. \n" + ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnIMC_Click(object sender, EventArgs e) { try { Isabel.Altura = double.Parse(txtaltura.Text); Isabel.Peso = double.Parse(txtpeso.Text); lblresultado.Text = Isabel.CalcularIMC().ToString(); } catch (FormatException ex) { MessageBox.Show("Erro. \n" + ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnCalcular_Click(object sender, EventArgs e) { try { string nome, idade, peso, altura; nome = txtNome.Text; idade = txtIdade.Text; peso = txtPeso.Text; altura = txtAltura.Text; Atleta atleta = new Atleta(); atleta.setNome(nome); atleta.setIdade(idade); atleta.setPeso(peso); atleta.setAltura(altura); lblResposta.Text = atleta.CalcularIMC().ToString("0.00"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_calc_Click_1(object sender, EventArgs e) { MessageBox.Show("Dados Obtidos: " + obj.ImprimeDados() + "\nIMC: " + obj.CalcularIMC().ToString()); lbl_imc.Text = obj.CalcularIMC().ToString("0.00"); }
private void btnCalcular_Click(object sender, EventArgs e) { MessageBox.Show("Dados Obtidos: " + obj.ImprimeDados() + "\nIMC: " + obj.CalcularIMC().ToString()); }
private void btn_calcularIMC_Click(object sender, EventArgs e) { MessageBox.Show("Dados obtidos: " + obj.ImprimeDados() + "\n\nIMC: " + obj.CalcularIMC().ToString("F")); txt_resultado.Text = obj.CalcularIMC().ToString("F"); }
private void btnCalculo_Click(object sender, EventArgs e) { MessageBox.Show(obj.ImprimirDados()); txtIMC.Text = obj.CalcularIMC().ToString(); }
private void btn_imc_Click(object sender, EventArgs e) { txt_result.Text = obj.CalcularIMC().ToString("0.00"); }