VB.NET Beginner Tutorial – Subs vs Functions & Building a Real-Time Calculator (Visual Basic .NET)

In this VB.NET tutorial for beginners, I will outline the basic differences between the Sub and Function, and demonstrate how they can be used. We will also build a real-time Calculator that calculates as you type and includes various operation types.

We will also learn how to create and employ an enumerated type list and return its members via Functions.

Skip Ahead:
0:36 Form Design
0:46 Explanation of Subs & Functions
6:35 Begin Coding
29:27 Create a Calculator

Source Code Download: https://www.dropbox.com/s/57f7zu8kdz513n4/SubsNFunctions.zip?dl=0


Chris M says:

Hey Great video! I’m new to VB, I just got a quick question, at around the 9 minute mark you created a Private Sub MakeTextBoxCool( ), I been trying to figure out why you made that? and did you name something on the form called MakeTextBoxCool( )? Thanks again for making all these great videos!!

Pete Constantinos says:

i was wondering if you could create a tutorial on the DataGridView.
i need to initialize the DataGridView with column header size, font and cell alignment and same for the data cells. Also perform some arithmetic to sum of a grid column and place the total into a textbox.

Catalin Moraru says:

Loved this video…the part with “Master”…really funny :)). Thanks for sharing the knowledge and regards from Romania 🙂

Chris M says:

lol, I’m actually watching your video over as we speak, I just started taking VB and everything was really simple at first and then it literally went from stupid easy to I’m really stupid and now I’m completely lost, we went from Boolean one week to If, Then Else statements the following week, and that’s where I got lost, IDK what I’m missing (probably my brain)…. This is what I’ve been doing day and night for the past two and a half weeks and I’m starting to go nuts, anyway thanks for the quick reply and the great videos…Greatly Appreciated

Manuel Lois says:

Not only this one, but all tutorials  u made are great, they helped me a lot. 

Thank you so much.

new leaf88 says:

I absolutely love every tutorial you make, you’re easy to follow and you speak clearly. I have watched almost all your videos since your first one. I am wondering if you could upload a tutorial on botting with a webbrowser control and possibly in the future, using web requests :). Thanks again for your help! Happy coding!

Michael Newman says:

Great tutorials.  Clear, concise and easy to follow.

Jacob Liang says:

The screen in the new videos are too small. Will be nicer if it is the same size as before.

Chris M says:

Lol trust me I’ve been waiting for that “ahhhh” moment where everything makes sense.. but you’re right, repetition is everything. I’ve actually been watching the crap out of your subs and function but I’m also writing everything down on paper and then entering it into VB w/o trying to look…. just like you said it’ll eventually hit me, seriously though, thank God for people like you who are willing to help out others just for the sake of it, and if I have any questions I’ll definitely ask ya, I’m sure I’ll have one or two.. Thanks again and keep up the great work!

Terry K says:

As usual, great tutorial.  I’ve learned a lot watching your tutorials.

I was surprised about one thing. In your Calculate function, you have a number of if statements and then the lonely Return 0. I would have thought that the function would always return 0 assuming that it would go through each statement and the last statement would be the final return.

Shwoop Swoop says:

Its good to see you back!

 Write a comment


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

Please click below to support us on Facebook!