-
August 17th, 2009, 12:54 PM
#1
Can't add class item to Collection..
I've defined a collection in my form:
Code:
private toDelete as new Collection
In my delete button I have this:
Code:
Private sub cmdDelete_Click()
Dim TM as new TestMeth
TM.X="foo"
TM.Y="bar"
toDelete.Add(TM)
end sub
TestMeth is a Class Module that has a bunch of Get/Let Properties
I get this error when trying to add it to the collection:
Run-time error '438'
Object doesn't support this property or method
-
August 17th, 2009, 02:06 PM
#2
Re: Can't add class item to Collection..
It seems your TestMeth Class does not define the properties X or Y.
Everything else is syntactically correct. Please examine the code of the class module if there are proper definitions of property routines (Let and Get) for X and Y
Code:
Public Property Let X (A as string)
End Property
If in doubt you ought to post the code of this class, so as we can take a look.
-
August 17th, 2009, 02:25 PM
#3
Re: Can't add class item to Collection..
TestMeth Class
Code:
Private m_sX As String
Private m_sY As String
Public Property Get X() As String
Line = m_sX
End Property
Public Property Let X(ByVal Value As String)
m_sX = Value
End Property
Public Property Get Y() As String
Method = m_sY
End Property
Public Property Let Y(ByVal Value As String)
m_sY = Value
End Property
-
August 17th, 2009, 02:38 PM
#4
Re: Can't add class item to Collection..
Use the add method without the brackets
-
August 17th, 2009, 03:04 PM
#5
Re: Can't add class item to Collection..
Originally Posted by Shuja Ali
Use the add method without the brackets
Thanks worked like a charm
-
August 17th, 2009, 09:18 PM
#6
Re: Can't add class item to Collection..
or use call statement too.
Code:
call toDelete.Add(TM)
-
August 18th, 2009, 08:29 AM
#7
Re: Can't add class item to Collection..
Or (that's why I did not spot this) put a blank in.
Strangely enough toDelete.Add (TM) works, too.
Tags for this Thread
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
|