Question
I have to make a BMI Calculator on Visual Studio for my Capstone Course. I have what I believe is the correct code, but any
I have to make a BMI Calculator on Visual Studio for my Capstone Course. I have what I believe is the correct code, but any time I run the application, it won't do the calculation. I am linking the BMI.aspx code as well as the BMI.aspx.vb code. Thanks in advance.
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/KSU Health and Healing.Master" CodeBehind="BMI.aspx.vb" Inherits="KSUBMI.BMI" %> Please fill out this web form! First Name: Your Age: Email Address: Your Weight (in lbs): Your Height (in inches): Here are your results: BMI Calculator
Public Class BMI Inherits System.Web.UI.Page Protected Sub ButtonCalculate_Click(sender As Object, e As EventArgs) Handles ButtonCalculate.Click Dim Weight As Double = TextWeight.Text Dim Height As Double = TextHeight.Text Dim Result As Double = (Weight * 703) / (Height * Height) LabelBMI.Text = Result
If Result < 18.5 Then LabelResults.Text = "Underweight" ElseIf Result >= 18.5 Or Result < 24.9 Then LabelResults.Text = "Normal weight" ElseIf Result >= 25 Or Result < 29.9 Then LabelResults.Text = "Overweight" ElseIf Result >= 30 Then LabelResults.Text = "Obese" End If End Sub Protected Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.Click TextName.Text = "" TextAge.Text = "" TextEmail.Text = "" TextWeight.Text = "" TextHeight.Text = "" LabelResults.Text = ""
TextName.Focus() End Sub
End Class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started