VB 编写程序,先将文本框(Text1)中输入的数值赋予变量X,然后在结论便签(Ladel1)中显示X是,正数负,数还是

如题所述

Private Sub Text1_Change()
If IsNumeric(Text1.Text) Then
    x = Val(Text1.Text)
    If x >0 Then
        Label1.Caption = "正数"
    ElseIf x < 0 Then
        Label1.Caption = "负数"
    Else
        Label1.Caption = "零"
    End If
Else
    Label1.Caption = ""
End If
End Sub

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答