自动计算文本框里的值
我有个文本框,输入1*2+4*5自动得到结果显示在Label1上结果为22
可以借用VBS. 在网上找了一现成的
Private Declare Function EbExecuteLine Lib "vba6.dll" (ByVal pStringToExec As Long, ByVal Unknownn1 As Long, ByVal Unknownn2 As Long, ByVal fCheckOnly As Long) As Long
Private Function ExecuteLine(sCode As String, Optional fCheckOnly As Boolean) As Boolean
ExecuteLine = EbExecuteLine(StrPtr(sCode), 0&, 0&, Abs(fCheckOnly)) = 0
End Function
Private Function calc() As String
ExecuteLine "dim x as double"
ExecuteLine "x= " & Text1.Text
ExecuteLine "clipboard.settext x"
Label1.Caption = Clipboard.GetText
End Function
Private Sub Command1_Click()
calc
End Sub