|
-
Nov 20th, 2004, 11:31 AM
#1
Thread Starter
Fanatic Member
-
Nov 20th, 2004, 12:44 PM
#2
you may want to put this in the MATH forum. You need to compute the value of A, and the equation computes nothing, as you can't assign a value to v^2. What you have would be v=SQR(rest of equation) to calculate the value of V.
-
Nov 20th, 2004, 02:27 PM
#3
Go to Project|References and add a reference to Microsoft Script Control 1.0. Then
VB Code:
Dim objMSC As New MSScriptControl.ScriptControl
objMSC.Language = "vbscript"
MsgBox objMSC.Eval("v^2 = v0^2 + 2a (x-x0)")
-
Nov 20th, 2004, 06:04 PM
#4
-
Nov 20th, 2004, 06:54 PM
#5
The value of the equation after substituting values for the variables.
-
Nov 20th, 2004, 07:00 PM
#6
The picture isn't missing
Or you can solve for 'a', then fill the values:
VB Code:
'first dim your variables. use the correct type:
'dim these: v,vo,x,xo
msgbox (v^2-vo^2)/(2 * (x-xo))
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 20th, 2004, 07:54 PM
#7
Thread Starter
Fanatic Member
Originally posted by MartinLiss
Go to Project|References and add a reference to Microsoft Script Control 1.0. Then
VB Code:
Dim objMSC As New MSScriptControl.ScriptControl
objMSC.Language = "vbscript"
MsgBox objMSC.Eval("v^2 = v0^2 + 2a (x-x0)")
I get an error:
Syntax error on the equation line
my code:
VB Code:
Dim v As Double
Dim v0 As Double
Dim a As Double
Dim x As Double
Dim x0 As Double
v = 1
v0 = 2
x = 0
x0 = 3
Dim objMSC As New MSScriptControl.ScriptControl
objMSC.Language = "vbscript"
MsgBox objMSC.Eval("v^2 = v0^2 + 2a (x-x0)")
' also "v^2 = v0^2 + 2*a (x-x0)" isn't working ---> type mismatch 'a'
' when i use:
'MsgBox objMSC.Eval("v^2 = v0^2 + 2*a * (x-x0)")
'the message is TRUE :ehh:
Seems that this doesn't like much the '='
It solves very well a simple expression
Last edited by TDQWERTY; Nov 20th, 2004 at 08:01 PM.
-
Nov 20th, 2004, 09:56 PM
#8
I get a complie error. UDT not defined. MS Scripting Control.ocx is referenced, too.
-
Nov 20th, 2004, 10:33 PM
#9
The picture isn't missing
Read my post. Anyways, MSScript can't solve for equations. Either you make your own solver or you solve it yourself for the variable then implement it as a formula.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 20th, 2004, 10:39 PM
#10
I got an error trying to create a new instance of ScriptControl. It never even got as far as the messagebox.
-
Nov 20th, 2004, 10:45 PM
#11
The picture isn't missing
Originally posted by dglienna
I got an error trying to create a new instance of ScriptControl. It never even got as far as the messagebox.
you are using this exact code?:
Dim objMSC As New MSScriptControl.ScriptControl
objMSC.Language = "vbscript"
MsgBox objMSC.Eval("v^2 = v0^2 + 2a (x-x0)")
when you do: Dim objMSC As New
and hit space, does MSScriptControl show up in the list?
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 21st, 2004, 12:31 AM
#12
nope. Form1, Global, and Project are among what is there...
but it is present in \system32 ?
it's in the project, and I've tried it with and without putting the control on my form1.
-
Nov 21st, 2004, 04:46 PM
#13
Thread Starter
Fanatic Member
thanks BuggyProgrammer now i understand, first i have to simplify the equation in orther to get a=........ then it will do the job 
thx for te nice help!
-
Nov 22nd, 2004, 12:24 AM
#14
Any help for me using MSSCRIPT.ocx?
-
Nov 25th, 2004, 12:44 AM
#15
The picture isn't missing
Originally posted by dglienna
nope. Form1, Global, and Project are among what is there...
but it is present in \system32 ?
it's in the project, and I've tried it with and without putting the control on my form1.
Sorry for responding so late
Are you checking it in the references or the tool box? It appears that you have added it as a control (which still works, just not creating it like a class).
If you loaded it like a control, it will work like the code, except you need to place the control on the form:
MSScriptControl1.Language="VBScript"
MSScriptcontrol1.exec "msgbox ""hi"""
Remember, if someone's post was not helpful, you can always rate their post negatively  .
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
|