Current location - Training Enrollment Network - Mathematics courses - How to write a program with vb to solve similar math problems: the problem of x= 1 and y=2 is substitution calculation.
How to write a program with vb to solve similar math problems: the problem of x= 1 and y=2 is substitution calculation.
It is suggested to use VB program to cooperate with VBS script.

That is, when VB completes a program point calculation button, it will automatically generate a VBS script and run it.

Give you a concrete example.

Botton 1 code:

Open "c:\zhen.vbs" and the output is # 1

Print # 1, "common function f(x, y)"

Print # 1," f=" + Text3。 text

Print # 1, "End function"

Print # 1," x=" + Text 1。 text

Print # 1," y=" + Text2。 text

Print # 1, "Strings=" "The result is:" "&; f(x,y)

Print # 1, "msgbox string", "done" ""

Close # 1

shell“cmd/c c:\ Zhen . VBS”,vbHide

Where text 1 needs to enter the value of x, text2 needs to enter the value of y, and text3 needs to enter the formula. Press button 1 and the result will pop up. It is not easy to write some code.