Good day again everyone,
i am using vb6, of which i am now learning to do scripting using scriptcontrol.
i can now write numeric calculations on text box and make an output from it.
like this
so if i type 5+1 on text1 it will outpult 6 on text2HTML Code:Dim script1 As ScriptControl Private Sub Command1_Click() amf = Text1.Text EXCECUTE = "NDP" & " = " & "Round(" & amf & ",2)" formula = EXCECUTE MsgBox (formula) script1.ExecuteStatement formula End Sub Private Sub Form_Load() Set script1 = ScriptControl1 script1.Language = "VBScript" script1.AddObject "NDP", Text2 End Sub
problem now is...
i got 3 textboxes A,B, and C each holding a number input.
i got another textbox which is COMP holding the "computation"
and last textbox for the output which is RSLT
now to be complex,
i am tring to write A+B+C on COMP
(e.g
A = 1
B = 2
C = 3
>>> on textbox COMP i write A+B+C
)
on command click i would like have the result on RSLT. which is like the above working program.
>the error i am getting with this is type mismatch and some ")" missing "string value:[]"
what i have done now is passing A,B,C to an integer variable, to string but with no luck still not working.
Code:Dim script1 As ScriptControl Private Sub Command1_Click() Dim psrp, gdp, cd As Integer psrp = A gdp = B cd = C amf = Text4.Text EXCECUTE = "NDP" & " = " & "Round(" & amf & ",4)" formula = EXCECUTE MsgBox (formula) script1.ExecuteStatement formula End Sub Private Sub Form_Load() Set script1 = ScriptControl1 script1.Language = "VBScript" script1.AddObject "NDP", Text5 End Sub
help please.
~liz




Reply With Quote