[求助]急!帮我些这个程序的代码吧。
任意输入一个整数,判定该整数的奇偶性。要求:用Label1显示“请输入一个整数:”,用Label2来显示判断的结果“奇”或“偶”,用Text1来输入整数,三个Command按钮用来判断、清除和结束程序。
帮我些下代码吧!!!
Private Sub Command1_Click()
Dim nII As Long
nII = Val(Me.Text1.Text)
If nII Mod 2 = 0 Then
Me.Label2.Caption = "偶数"
Else
Me.Label2.Caption = "奇数"
End If
End Sub
Private Sub Command2_Click()
Me.Text1.Text = ""
Me.Label2.Caption = "没有结果"
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Text1.Text = 0
End Sub
Private Sub Text1_LostFocus()
Me.Text1.Text = Val(Me.Text1.Text)
End Sub