How to Make a BMI Calculator

Creating a BMI calculator will make it easy to keep track of your weight during your weight gain or weight gain program. To do this you must have some basic skill with Visual Basic or Visual If you don’t have any knowledge with these software you can use Microsoft Visual Basics to create this useful tool.

Step 1

This incorporates the use of Microsoft Visual Basic Express.

Open the program. Select ‘new project’ option. Then, choose “windows application”. When asked for a type, submit “BMI Calculator” and then click Ok. Now you need to change the text properties. Do this by using the Properties panel located on the bottom right of your screen. Label it ‘BMI Calculator’.

Step 2

You need to now create labels. Create the 2 labels you need by double clicking the label tool. The label tool is located in the toolbox on the left hand side. It is marked with a large letter “A”. Repeat this process again for your second label. Click and drag each label to the form so that they are vertical.

Step 3

You’ll need to also create two text boxes. You can do this in the same manner you created your labels except you need to use the “Textbox” tool. Each label should get one box next to it.

Step 4

Now you’ll need to create a command button by double clicking the “Button” tool. Place this below the labels you just created.

Step 5

Create your third label using the steps above. Place this label next to the command button. Arrange the sizes of all the labels. You can do this by going into the properties panel at the right of the screen. Enter 180 as a width and 25 as a height. Make the third label 25 height and a width of 150.

Step 6

The property of the top label should read “Enter your weight in pounds”. The next label should read “Enter your height in inches”. For the third label you should delete any previous text and enter “BMI Result”. Now, the command button should be changed to read “Calculate”.

Step 7

This part is a little challenging. You need to add code. Open the “Calculate” button by double clicking. Enter the following code between “private sub” and “end sub” lines when they appear.

Dim BMI as Single

Dim Height as Short

Dim Weight as Short

Height = CShort(Text2.Text)

Weight = CShort(Text1.Text)

BMI = (Weight / (Height_Renamed * Height_Renamed)) * 703


BMIResult.Text = “Your BMI is” & BMI.ToString(“F1”)

Step 8

Make sure your BMI calculator is working. Test it by pressing the f5 function key. Results should populate in the blank space right next to “Calculate”. When it does press “CTRL + S’ to save this BMI calculator. If you have any issues you should return to the coding and look for mistakes. Correct them, then click ‘build’. Pin the .exe file to the start menu on your laptop or computer. You can also copy it to the desktop for easy access.

Filed Under: Computers & Technology


About the Author: Justin Belden is a freelance web & graphic designer with over 15 years' experience. He is also an Avid member of the Design/Development community and a Serial Blogger who loves to help people by sharing interesting and informative tips and trick related to computer and technology.

RSSComments (0)

Trackback URL

Comments are closed.