brspurri
asked on
Script control Procedures
Hello,
I have this text in a textbox that I need to have a script control execute.
'-----------------------
Public Z As Integer
Function X(y As Integer) As Integer
Z = Y + Z
End Function
Function W(y As Integer) As Integer
Z = Y - Z
End Function
'------------------------
I need to have the code added to a script control and then be able to call the functions while retaining the Z value. Is this possible?
Thanks!
Brett
I have this text in a textbox that I need to have a script control execute.
'-----------------------
Public Z As Integer
Function X(y As Integer) As Integer
Z = Y + Z
End Function
Function W(y As Integer) As Integer
Z = Y - Z
End Function
'------------------------
I need to have the code added to a script control and then be able to call the functions while retaining the Z value. Is this possible?
Thanks!
Brett
ASKER
What about the "Public Z As Integer"? I need to keep track of the value of Z as each sub is called. And thank you, I meant to call them Subs.
-Brett
-Brett
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you! One more thing though. Do you know if you can use Public to reference variables in other modules of the script control (ie: ScriptControl1.Modules("Mo dA")) ?
Thanks!
Thanks!
I dont believe you can.
brspurri:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
Moderator, my recommended disposition is:
Accept Gunsen's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
Accept Gunsen's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
F = F & "Sub X(y)" & vbCr
F = F & "Z = Y + Z" & vbCr
F = F & "End Sub" & vbCr
F = F & "Sub W(y)" & vbCr
F = F & "Z = Y + Z" & vbCr
F = F & "End Sub" & vbCr
ScriptControl1.AddCode F
ScriptControl1.ExecuteStat
ScriptControl1.ExecuteStat
ScriptControl1.ExecuteStat
MsgBox ScriptControl1.Eval("Z")