VB编程题,任意输入一个数,判定是否为整数。 10
1个回答
2016-01-12
展开全部
Private Sub CommandButton1_Click()
Dim nNum As Long
If IsNumeric(TextBox1.Text) Then
nNum = Val(TextBox1.Text)
If nNum Mod 5 = 0 Then
MsgBox "能被5整除!", vbInformation, "提示"
Else
MsgBox "不能被5整除!", vbInformation, "提示"
End If
Else
MsgBox "输入不正确!", vbExclamation, "提示"
TextBox1.SetFocus
End If
End Sub
Dim nNum As Long
If IsNumeric(TextBox1.Text) Then
nNum = Val(TextBox1.Text)
If nNum Mod 5 = 0 Then
MsgBox "能被5整除!", vbInformation, "提示"
Else
MsgBox "不能被5整除!", vbInformation, "提示"
End If
Else
MsgBox "输入不正确!", vbExclamation, "提示"
TextBox1.SetFocus
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |