Serializing a vb object

svfafel
svfafel used Ask the Experts™
on
I would like to know if it is possible to serialize an object in vb6???  I have looked around and am confused about IPersistStream, IStream, Property bag, etc....

any info would be helpful..
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I am not working with .Net - i am trying to implement this with Visual Basic 6

any clues?
I'm not familiar with serialization.  If you could give more text explaining what it is and what you are trying to do wth it, perhaps I can help.  I did see that you weren't using VB .Net, but I thought perhaps MSXML provided the serialization you wanted.

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Hi,

If you want other systems to be able to serialize your objects (for example COM+), then you need to implement one of the serializable interfaces, I forget which one. If you want to serialize for your own purposes, then you can do it however you want.

Regardless of whether you implement one of the serializable interfaces, one way to actually perform the serialization is to use the property bag obejct that VB provides. With it you can add class properties to and it will return them all encoded as a string. You can then assign that string to another property bag and extract the properties again. If you don't like property bag, and personally I don't because it encodes the GUID of your class, and won't work if you recompile and change the GUID, then you can use XML as suggested by Kimpan, or you could even roll your own serialization mechanism.

HTH,

Zaphod.
Ah, now I understand,

Her's an article on it (works in VB5 also):

http://archive.devx.com/premier/mgznarch/vbpj/1998/11nov98/cb1198.pdf
Please maintain this question.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- assign points to twalgrave
Please leave any comments here within the
next seven days.
Force accepted

** Mindphaser - Community Support Moderator **

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial