Help: Life of Controls in DataSpaces
If I create a class in a dataspace with a private variable called Count then every time I run a function in this class the private variable is set to zero.
This is provided I create the object via a DataSpace
ie X.Y
Private Count as Long
Public Function Add(Num as Long) as Long
Count = Count + Num
Add = Count
end function
---
If I use the dataspace.createobject to a global object, then every time I call Add(Num) the value returned by Add is Num not the totaled amount.
Any ideas how to make this object stay persistent?
Thanks
DS
Re: Help: Life of Controls in DataSpaces
Use a static variable in your function.
public Function Add(Num as Long) as Long
static Count as Long
Count = Count + Num
Add = Count
End Function