Functions and Importance of Variables in Visual Basic Programming

CODES IN ORDER TO CREATE THIS FORM

 

12

  • In the form class, I have declared the variables. Two variables are for accepting the numbers for the calculation.
  • The third variable is of type Integer that has used to perform the operation such as Addition, Subtraction, Multiplication, and Division.
  • In the first part, the ” Dim num1 as Integer “, ” Dim num2 as Integer ” and ” Dim answer as Integer ” is to set the terms that will be used all throught out the program code that’ll be used.
  • Then in the next part is for the 2 textbox where you will put the numbers you want to be solved.Where you type ” num1 = Textbox1.Text ” and ” num2 = Textbox2.Text “
  • Then the next one is the ” Answer = num1 + num2 ” for the operation to be applied.
  • The last part is the “Textbox3.Text = Answer ” where you will see the answer.
  • And if you want to change the operation from addition, just change the terms in the first part from sum to difference, product or quotient.

Leave a comment