|
-
Sep 28th, 2000, 08:40 AM
#1
Thread Starter
Addicted Member
Hello!
I have a little problem with my collection object. When I try to add something to it, I get an error (91: Object variable or With variable not set.)
Here's the code I use:
Code:
Type Vpr
vVpra As Collection
oOdgo As Collection
End Type
Public kVpr As Vpr
Sub Add(str1, str2)
With kVpr
.vVpra.Add str1
.oOdgo.Add str2
End With
End Sub
What have I done wrong?
As much as I know there should be no errors. Or I forgot something?
Zvonko Bostjancic
Ilirska Bistrica, Slovenia
[email protected]
Using VS6 Professional with SP3
Programming mostly in VB and I've started to learn VC++ & MFC
-
Sep 28th, 2000, 08:45 AM
#2
Addicted Member
Hi,
You need to declare a new instance of your collections
Code:
Type Vpr
vVpra As New Collection 'Declare new instance
oOdgo As New Collection 'of the collection object
End Type
Public kVpr As Vpr
Sub Add(str1, str2)
With kVpr
.vVpra.Add str1
.oOdgo.Add str2
End With
End Sub
Hope this helps
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 28th, 2000, 08:55 AM
#3
Thread Starter
Addicted Member
Collections must be declared, too?
I didn't know.
Thanks.
Zvonko Bostjancic
Ilirska Bistrica, Slovenia
[email protected]
Using VS6 Professional with SP3
Programming mostly in VB and I've started to learn VC++ & MFC
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|