按要求在窗体上添加一个标签和一个文本框以及一个命令按钮,双击命令按钮,删除所有代码,复制如下代码到程序中
Private Sub Command1_Click()
If Val(Text1) Mod 2 = 0 Then
Label1 = "偶数"
Else
Label1 = "奇数"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) '判字帆知符
If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 '盯启0-9字符之外屏蔽
End Sub
若满意请及时采纳,谢谢凯轿如