|
-
May 19th, 2002, 05:16 PM
#1
Thread Starter
New Member
Please help me
Hi I'm new to vb and would like to know the code for doing mathematical equations e.g. adding, multiplying, with textboxes and comboboxes, which saves the answer to a invisible textbox/combobox to be retrieved later
thanks
buzzlightyear
-
May 19th, 2002, 05:20 PM
#2
-= B u g S l a y e r =-
VB Code:
Private Sub Command1_Click()
Text2.Text = Val(Text1.Text) + Val(Combo1.Text)
End Sub
Private Sub Form_Load()
Text2.Visible = False
End Sub
I would store the number in a variable though
-
May 19th, 2002, 05:28 PM
#3
Thread Starter
New Member
Thanks peet
but how do you place brackets in the code as to make one step before the other. e.g. 2+(4-1) and what is the sign for multiplying and where is it placed
thanks
buzzlightyear
Last edited by buzzlightyear; May 19th, 2002 at 05:32 PM.
-
May 19th, 2002, 05:34 PM
#4
Hyperactive Member
You can do as you have wrote 2+(4-1). ie.
Code:
Text2.Text = val(Text3.Text) - (Val(Text1.Text) + Val(Combo1.Text))
'or
Text2.Text = 2 + (4 - 1)
The code follows the same rules of maths... totaling calculations in brackets before calculating the total.
See ya later,
-=XQ=-
"Reality is merely an illusion, albeit a very persistent one. "
- Albert Einstein (1879-1955)
This is the coolest site ever!!!
-
May 19th, 2002, 06:06 PM
#5
PowerPoster
Originally posted by -=XQ=-
You can do as you have wrote 2+(4-1). ie.
Code:
Text2.Text = val(Text3.Text) - (Val(Text1.Text) + Val(Combo1.Text))
'or
Text2.Text = 2 + (4 - 1)
The code follows the same rules of maths... totaling calculations in brackets before calculating the total.
and from left to right.
The sign for multiplication is the asterisk (*)
-
May 20th, 2002, 12:43 AM
#6
Brackets, Or, Division, Multiplication, Addition, Subtraction. The same rule follow for math eqn's in VB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|