从文本框text1中输入一个整数单击判断command1判断其奇偶性并在label1中显示结果

提行位置说下,感想

第1个回答  2012-06-30
Private Sub Command1_Click()
If IsNumeric(Text1) Then Label1.Caption = IIf(Val(Text1) Mod 2 = 1, "奇数", "偶数") Else Label1.Caption = "error!"
End Sub
'---------------------
'换行?其实跟上面代码的意思完全一样,这样好理解一些
Private Sub Command1_Click()
If IsNumeric(Text1) Then
If Val(Text1) Mod 2 = 1 Then
Label1.Caption = "奇数"
Else
Label1.Caption = "偶数"
End If
Else
Label1.Caption = "error!"
End If
End Sub本回答被提问者采纳
第2个回答  2012-06-30
从数据
相似回答