Vb6 &引用;“未定义用户定义类型”;错误
嗨,我正在尝试创建一个简单的程序,其中包含一个对象和一个类 vb6.0 我收到的错误消息是:“未定义用户定义的类型” VB怀疑突出显示的代码是“Dim Bob As Ball” 我定义的类如下:Vb6 &引用;“未定义用户定义类型”;错误,vb6,Vb6,嗨,我正在尝试创建一个简单的程序,其中包含一个对象和一个类 vb6.0 我收到的错误消息是:“未定义用户定义的类型” VB怀疑突出显示的代码是“Dim Bob As Ball” 我定义的类如下: Dim Bob As Object Public Sub Ball() Dim Circlex As Integer Dim Circley As Integer Public Sub makeBall() Circlex = 3000 Circley = 3000 End Sub Priv
Dim Bob As Object
Public Sub Ball()
Dim Circlex As Integer
Dim Circley As Integer
Public Sub makeBall()
Circlex = 3000
Circley = 3000
End Sub
Private Sub moveBall()
Circle (Circlex, Circley), 200
End Sub
End Sub
我的项目中唯一表单的代码是:
Private Sub Command1_Click()
Command1.Visible = False
Command1.Enabled = False
vbalProgressBar1.Visible = True
Timer1.Enabled = True
Beep
End Sub
Private Sub Form_Load()
Form1.Width = 6000
Form1.Height = 6000
Dim Bob As Ball
Dim Bob As New Ball
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Are you sure you want to be a quitter?!"
, vbYesNo,"Quit?") = vbYes Then
Unload Me
Set Form1 = Nothing
Else
Cancel = 1
End If
End Sub
Private Sub Timer1_Timer()
Bob = moveBall(Circlex, Circley)
End Sub
我不知道为什么可疑的代码行是不正确的,但任何帮助将不胜感激 VB6不使用您编写的代码样式。 您必须遵循这些方法才能使代码按照您的意图工作。 1.制作类模块 2.将其名称设置为“Ball” 3.将此代码粘贴到classmodule上
Dim Circlex As Integer
Dim Circley As Integer
Public Sub makeBall()
Circlex = 3000
Circley = 3000
End Sub
Private Sub moveBall()
Circle (Circlex, Circley), 200
End Sub
Private Sub Command1_Click()
Command1.Visible = False
Command1.Enabled = False
vbalProgressBar1.Visible = True
Timer1.Enabled = True
Beep
End Sub
Private Sub Form_Load()
Form1.Width = 6000
Form1.Height = 6000
Dim Bob As New Ball
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Are you sure you want to be a quitter?!"
, vbYesNo,"Quit?") = vbYes Then
Unload Me
Set Form1 = Nothing
Else
Cancel = 1
End If
End Sub
Private Sub Timer1_Timer()
Bob.moveBall(Circlex, Circley)
End Sub
Sub A()
Sub B()
End Sub
End Sub
除非您有一个名为
Ball
的类或结构,否则错误消息是正确的,可能是重复的