Private Sub Text1_KeyPress(KeyAscii As Integer)
On Error GoTo Errhandler
If KeyAscii = 13 Then
Set sc = CreateObject("ScriptControl")
sc.Language = "VBScript"
Text1.Text = sc.EVal(Text1)
Set sc = Nothing: KeyAscii = 0
End If
Errhandler:
If Err > 0 Then MsgBox Err.Description
End Sub
Dim X1!, Y1!
Private Sub Form_Activate()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
Me.KeyPreview = True
Text1.Text = "": Text2.Text = "": Text1.SetFocus
End Sub
Private Sub Command1_Click()
Text2.Text = ""
ScriptControl1.Language = "VBScript"
ScriptControl1.ExecuteStatement "x1 = " & X1
Y1 = ScriptControl1.Eval(Text1.Text)
ScriptControl1.Reset
Text2.Text = CStr(Y1)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii <> 0 Then
Select Case KeyAscii
Case 27
End
Case 13
Command1_Click
Case Else
End Select
End If
End Sub