Home > Software engineering >  VB how to input any mathematical formula can be identified and assigned to calculate
VB how to input any mathematical formula can be identified and assigned to calculate

Time:09-28

I think of the method of using write a scientific calculator, and buttons are all operators, specific how to achieve? Is there a great god,

CodePudding user response:

To what extent are arbitrary, including calculus?

CodePudding user response:

You don't have elementary calculus, and can, including addition, subtraction, multiplication, and division are negative, trigonometric function, logarithmic, the algebraic expression of the arbitrary power of line

CodePudding user response:

Do you classify some code is ok,

CodePudding user response:

Beginners do not how,,, eldest brother can be a bit specific,,, thank you,,

CodePudding user response:

Simple point, use the Microsoft Scripting Control calculation,
 Private Sub Command3_Click () 
Dim cs As New ScriptControl
Dim t As String
T=Text1. Text
Cs. Language="VBScript"
Cs. AddCode t
Dim r As String
R=cs. Run
End Sub

CodePudding user response:

reference 5 floor VBToy reply:
simple point, use the Microsoft Scripting Control calculation,
 Private Sub Command3_Click () 
Dim cs As New ScriptControl
Dim t As String
T=Text1. Text
Cs. Language="VBScript"
Cs. AddCode t
Dim r As String
R=cs. Run
End Sub

+ 10086

CodePudding user response:

I want to say is, can enter, like more complex functions such as sin (x ^ 2 + 5 * x) + e ^ (y + 2) + 5, such a complex formula, can be solved? Trouble,,,

CodePudding user response:

 

Private Sub Command1_Click ()
The Set ms=CreateObject (" MSScriptControl. ScriptControl)
Ms. Language="JScript"
Ms. AddCode "x=3.1; Y=4.2; E=2.71828182845905; Z=Math. Sin (math.h pow (x, 2) + 5 * x) + math.h pow (e (y) + 2) + 5;"
The Debug. Print Ms. Eval (" z ")

X=3.1
Y=4.2
E=2.71828182845905
G=Sin (x ^ 2 + 5 * x) + e ^ (y + 2) + 5
The Debug. Print g
End Sub

CodePudding user response:

refer to 7th floor liudai123 response:
I want to say is that, to be able to enter as more complex functions such as sin (x ^ 2 + 5 * x) + e ^ (y + 2) + 5, such a complex formula, can be solved? Trouble,,,


Can, complex can be again,
Vbscript, jscript code can perform,

CodePudding user response:

Ms script control controls

CodePudding user response:

Each of these approaches a function,,,
  • Related