Purpose of this tutorial: Shows you how to make a simple Multiplication Program.
1.First start up Vb6, create a "Standard EXE", and Name the Form "MultiplicationProg" and set the caption to "Simple Multiplication Program". Next, make 3 Text Boxes, 1 label button, and 2 command buttons ---------------------------------------------------------------------------------

----------------------------------------------------------------------------------
2. Double Click the OK Command button to enter the code display.
Type the following:
Code: Select all
N1 = Val(Num1.Text)
N2 = Val(Num2.Text)
V = Val(Num1.Text) * Val(Num2.Text)
Answer.Text = Str$(V)
Ok I'm going to try and explain the code above:
N1 = Val(Num1.Text) = N1 is the short name we used instead of writing "num1" we just called it N1. the "=" signs tell it what N1 equals (or what it is) which in this case is the Text Box "Num1" .
The "Val" figures out the Value of whats inside of "Num1.Text" therefor to do match calculations.
----------------------------------
N2 = Val(Num2.Text) Is the same as above, but for Num2.Text
----------------------------------
V = Val(Num1.Text) * Val(Num2.Text)
This tells the program what to do in Math Calculations - Multiply, this tells it to multiply Num1.Text Times Num2.Text, (the Val tells it go figure out whats in Num1.Text and Num2.Text so it can perform match calculations)
-----------------------------------
Answer.Text = Str$(V)
This procedure tells the program to show the outcome of "Val(Num1.Text) * Val(Num2.Text)" to the "Answer.Text". Str$(V) I believe is a code so show the outcome of ANY mathematic problem.
---------------------------------------------------------------
After writing the Code above into the OK Command Button, click the X, and go back to the main program, and press F5 to run the program. Type 3 in the first Text Box and 5 in the Second Text Box and Click "OK":

------------------------------------------------------------------
The answer should appear in the lower Text Box.
Now this is the last step: instead of going into each Text Box, and deleting everything manually, we will use the Clear Command Button to do that for us!
3. Double click the "Clear" Command Button and type this syntex:
Code: Select all
Num1.Text = ""
Num2.Text = ""
Answer.Text = ""
--------------------------------------------
Num1.Text = ""
Num2.Text = ""
Answer.Text = ""
This tells the Clear button to make Num1.Text Clear.
for whatever you put in the parenthesis will show up. Nothing is between the parenthesis, so nothing will appear. Nifty huh?
Double click the Form (not any text box/label/command button specificaly, just the form "the box")
----------------------------------------------------------

----------------------------------------------------------
To make the program Go to File> Make MultiplicationProg.EXE
This concludes my tutorial, hope you enjoyed it, until next time.
If you have any questions dont hesitate to E-mail me:
[email protected]
^ ^ ^ ^ ^ ^
Thats always my yahoo messenger Screen name (in the @sbcglobal.net line also)
AIM: Ice daggereg (rarely on)