求助,TEXT控件
在文本框TEXT1中输入X的值,按下回车键时根据下面的函数求Y的值并显示在Label1中。怎样写出来```
Y=LOGX/LOG2 X> 0
Y=1/ABS(X) X <0
[解决办法]
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim X As Double
If KeyCode = 13 Then
X = Val(Trim(Text1.Text))
If X > 0 Then
Label1.Caption = Log(X) / Log(2)
ElseIf X < 0 Then
Label1.Caption = 1 / Abs(X)
End If
End If
End Sub