'供参考。朋友。界面如你图。复制代码过去就可以了。
Private Sub Command1_Click()
Dim n As Integer, m As Integer
m = 1
n = Val(Text1.Text)
If n >= 1 And n <= 6 Then
For I = 1 To n
m = m * I
Next I
Text2.Text = m
Else
MsgBox ("请重新输入n值!")
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
End Sub