子程序和函数未定义 VB

来源:百度知道 编辑:UC知道 时间:2024/07/16 11:37:59
Option Explicit
Private Function isprime(i As String) As String

Dim x, y, w As Integer
If numberic(i) Then

If Val(i) < 0 Then
isprime = "输入正整数"
Text1.SetFocus
End If
End If
y = Sqr(i)
For x = 2 To y
If i Mod x = 0 Then
isprime = "非质数"
End If
If x > y Then
isprime = "是质数"
End If

End Function

Private Sub Command1_Click()

Dim p As String
p = Text1
Text2 = isprime(p)
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

numberic(i)错了,应该是isNumberic,查一下帮助文件

不知道你要问什么??
如果子程序和函数写在主程序前面是不需要申明定义的。
如果子程序和函数写在主程序后面是一定要在主程序前申明定义的。