Multiplication Program Tutorial *VB* Screenshots

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
Cheech|N|Chong





Posts: 115
Joined: Fri Jan 14, 2005 9:26 am
Location: Why The Fuck Would I Tell You? Indiana...
Contact:

Multiplication Program Tutorial *VB* Screenshots

Post by Cheech|N|Chong »

This is my second tutorial on VB6

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 ---------------------------------------------------------------------------------
Image
----------------------------------------------------------------------------------
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)
[/color]

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":
Image
------------------------------------------------------------------
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 = ""
Run the program again put ANY numbers in the text boxes and click clear afterwards. It should automatically clear the textboxes.
--------------------------------------------
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")

----------------------------------------------------------
Image
----------------------------------------------------------
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)
Last edited by Cheech|N|Chong on Thu Mar 17, 2005 11:26 am, edited 1 time in total.
Signature exceeded 75KB.
Cheech|N|Chong





Posts: 115
Joined: Fri Jan 14, 2005 9:26 am
Location: Why The Fuck Would I Tell You? Indiana...
Contact:

Post by Cheech|N|Chong »

any comments are widely accepted 8)
Signature exceeded 75KB.
Post Reply