Problem storing object in PropertyBag 
Author Message
 Problem storing object in PropertyBag

I am trying to store several properties of mixed type in a propertybag.
These include a couple integers but also an array of objects. I have no
problem with reading or writing the integers but the array is
different. I have tried instead of writing the whole array, writing it
out element by element (object by object). But all that I get when I
read the propertybag is the default value. Any suggestions?

Thanks
Sara Carlin

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 07 Jul 2002 03:00:00 GMT  
 Problem storing object in PropertyBag
Try

For idx = 1 to UBound(myArray)
    m_myProperty = myArray(idx)
    .WriteProperty "myProperty(" & CStr(idx) & ")", m_myProperty,
m_def_myProperty
Next

and

ReDim myArray(n)    'Where 'n' is the upper limit of the object array.
For idx = 1 to x
    myArray(idx) = .ReadProperty("myProperty(" & Cstr(idx) & ")",
m_def_myProperty)
Next

Hope this helps.....John


Quote:
>I am trying to store several properties of mixed type in a propertybag.
>These include a couple integers but also an array of objects. I have no
>problem with reading or writing the integers but the array is
>different. I have tried instead of writing the whole array, writing it
>out element by element (object by object). But all that I get when I
>read the propertybag is the default value. Any suggestions?

>Thanks
>Sara Carlin

>Sent via Deja.com http://www.deja.com/
>Before you buy.



Mon, 08 Jul 2002 03:00:00 GMT  
 Problem storing object in PropertyBag
The biggest thing I was missing was readproperty and writeproperty
methods for each of the classes I was trying to write to the
propertybag. Once I added them, and then wrote out each array as John
recommended, everything worked fine.

Thanks for the help.



Quote:
> Try

> For idx = 1 to UBound(myArray)
>     m_myProperty = myArray(idx)
>     .WriteProperty "myProperty(" & CStr(idx) & ")", m_myProperty,
> m_def_myProperty
> Next

> and

> ReDim myArray(n)    'Where 'n' is the upper limit of the object array.
> For idx = 1 to x
>     myArray(idx) = .ReadProperty("myProperty(" & Cstr(idx) & ")",
> m_def_myProperty)
> Next

> Hope this helps.....John



> >I am trying to store several properties of mixed type in a
propertybag.
> >These include a couple integers but also an array of objects. I have
no
> >problem with reading or writing the integers but the array is
> >different. I have tried instead of writing the whole array, writing
it
> >out element by element (object by object). But all that I get when I
> >read the propertybag is the default value. Any suggestions?

> >Thanks
> >Sara Carlin

> >Sent via Deja.com http://www.deja.com/
> >Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 12 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Duplicate keys allowed with VB PropertyBag object ???

2. Duplicate keys allowed with VB PropertyBag object ???

3. RESUBMISSION - persisting objects in ActiveX control propertybag

4. persisting objects in ActiveX control propertybag

5. VB5 PropertyBag object only working at design time

6. Using Propertybag object to carry data over network

7. Duplicate keys allowed with VB PropertyBag object ???

8. persisting objects in ActiveX control propertybags

9. PropertyBag Contents Problem

10. Problem with Crystal Reports and Excel OLE-object stored in SQL Server 6.5 and vertical text

11. Problem with arrays stored in objects

12. Problem with EXEs stored as OLE Objects in A97 on W95/NT

 

 
Powered by phpBB® Forum Software