Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then 'call 函数 End If End Sub
例如:Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text1 = MYFUN(Val(Text1)) KeyAscii = 0 End If End Sub Function MYFUN(A As Long) As Long MYFUN = A ^ 2 End Function
If KeyAscii = 13 Then
'call 函数
End If
End Sub
If KeyAscii = 13 Then
Text1 = MYFUN(Val(Text1))
KeyAscii = 0
End If
End Sub
Function MYFUN(A As Long) As Long
MYFUN = A ^ 2
End Function