Visual Basic: Variables and Calculations

This is my 2nd Visual Basic Tutorial and it will show you how to add two numbers together and display the answer. After we get the answer to be calculated and displayed, I will then show you how to clear the form. In this tutorial I will show you how to create a integer variable to store data in and how to preform a simple calculation. Check out for more programming tutorials and for the source code used in this tutorial.


Jhany Delabest says:

Creat a program the requires the user to input an array of 10 entegers and then output their sum, average, lowest value and highes value.

sample input:
integers: 1 2 3 4 5 6 7 8 9 10

sample output:
sum: 55
Average: 5.5
Lowest value: 1
Highest value: 10

Vicky Lozada says:

I have problems with my homework you can give me a hand

DiYGrGamer says:

I want to make program that has 4 variables that you can change and will automaticly be saved in office word along with some fixed text.
Im making signs that have some fixed words and then the names of my clients. So, I want to just enter the names and information in the variables and automaticly aply them in word. I also want to have a fixed ajustment of the scale of the letters.

MOGAR22 says:

You’ve saved my ass kind sir. I’m recommending your channel and site to everyone during the spring semester 2014! I had a jist of what to do, but none of it clicked until I view your tutorial! 

A Benjeddi says:

great one, thank you

Ben Weeks says:

U can make this shorter when declaring variables u dont need lots of lines if u r using same data type e.g

Dim intNum1, intNum2, intTotal As Integer

This is better way of doing it

John Alfred S.Dollano says:

Excuse me sir , can i always use this dim as integer , instead of , example : TxtAve=(Val(Txtq1.text) + Val(Txtq2Text) …….etc , please reply

Vasto Lorde says:

How do you do multiplications and work with percentages?

bojanmazz says:

please can you do a tutorial on how to create an offline database that stores information on a single box and extends exponentially to infinity through a one to two matrix from the former

Pretesh Dayal says:

,im having a small problem with my Execl VBA project of which in writing a code to analyse a Portal Frame for Civil Engineers.
i have a Value in a cell, of which i need to multiply it be a variable of X. the X has no value but is just a X, so that the output will be valueX

50 {cell A1}>>>>>>>> VBA code to do multiplication

output = 50X {cell C4}

your help will be highly appreciated

Alex smith says:

i fuckin love you bro

snopyviewer says:

what if the user didn’t enter a number in num1 or num2 and the user just skipped ahead and press calculate the program crashed hw can I fix that error

Damulira Yusuf says:

Will this work in VS 2013 professional?

Desi Desh says:

Hello I need help with one application could you please help me??

sajad ali says:

dude u are great great teacher …

Aaron Wheeler says:

Do you post anything dealing with 2012 if so I need to find out how to do the same thing your doing only with 2012.

Marquita Ross says:

Thank you so much!!! You made it seem simple for me. Please continue to post tutorials, you helped tremendously!!!

John Alfred S.Dollano says:

Can i use this ? instead of “Txtave=(Val(Txtq1.text)+Val(Txtq2.text) ….etc…either if it is different sign too? like subtract , multiply ?

sulaiman sharraph says:

With well designed form, write a visual basic program that uses the follwing operators: addition, subtraction, multiplication and division. Hint: Your form should contain atleast two variables input, two command buttons with captions calculate and exist, three text boxes , one to display output and the remaining to serves as input… Can you solve this for me sir

John Alfred S.Dollano says:

i have a lot problem in when i going to code , doing a flowchart in visual basic

pramod pal says:

great one simple and helpful

The learning channel says: mean that a calculator is not made in vb 6.0??

Isma'el Khan says:

Awesome stuff. Thanks.

The learning channel says:

sir..can you please tell me how to make a 3- digit calculator in visual basic 0.6 ….please bcz i have to make my school project…?????

mpumelelo sibanda says:

Thanks Mr Neil, your tutorials are just good.

TheVJackV says:

If textbox1.text = “” Then
‘do nothing

Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours