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
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.
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
Re: Can't add class item to Collection..
Use the add method without the brackets
Re: Can't add class item to Collection..
Quote:
Originally Posted by
Shuja Ali
Use the add method without the brackets
Thanks worked like a charm :D
Re: Can't add class item to Collection..
or use call statement too.
Code:
call toDelete.Add(TM)
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. :)