vb编辑的简单的代码,执行时有点问题,Help!

来源:百度知道 编辑:UC知道 时间:2024/05/04 15:51:38
Private Sub Command1_Click()
Dim m As Long, n As Long, temp As Long
If (Val(Text1.Text) = 0 Or Val(Text2.Text) = 0) Or Val(Text1.Text) > 50 Or Val(Text2.Text) > 50 Then
MsgBox "Number Error, Input Please "
MsgBox "Number Error, Input Please ", vbInformation + vbYesNo, "Number Error"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
m = Val(Text1.Text)
n = Val(Text2.Text)
If m < n Then
temp = m: m = n: n = temp
End If
Do
r = m Mod n
m = n
n = r
Loop While r <> 0
End If
End Sub

Private Sub Form_Load()
Command1.Caption = "START"
Label1.Caption = "Please input two Integer:"
Label2.Caption = "m and n 的最大公约数:"
End Sub

Private Sub Command1_Click()
Dim m As Long, n As Long, temp As Long
If (Val(Text1.Text) = 0 Or Val(Text2.Text) = 0) Or Val(Text1.Text) > 50 Or Val(Text2.Text) > 50 Then
MsgBox "Number Error, Input Please "
MsgBox "Number Error, Input Please ", vbInformation + vbYesNo, "Number Error"
Text1.Text = ""
Text2.Text = ""
End If
Text1.SetFocus
m = Val(Text1.Text)
n = Val(Text2.Text)
If m < n Then
temp = m: m = n: n = temp
End If
Do
r = m Mod n
m = n
n = r
Loop While r <> 0
Label2.Caption = "m and n 的最大公约数:" & m
End Sub

Private Sub Form_Load()
Command1.Caption = "START"
Label1.Caption = "Please input two Integer:"
End Sub

Private Sub Command1_Click()
Dim m As Long, n As Long, temp As Long
If (Val(Text1.Text) = 0 Or Val(Text2.Text) = 0) Or Val(Text1.Te