|
-
Oct 22nd, 2004, 02:40 PM
#1
Thread Starter
Fanatic Member
Passing Class Objects Between Project Instances
I have a VB application that instantiates object classes. My clipboard methods within the application, place the object's key onto the clipboard and when I need to interact with the clipboard I use the key that is stored to copy/paste "elements", which are really objects. So in other words I have an Elements Class which is composed of Element classes. To copy an Element Object, I store the Key of the Element Object on the clipboard, to paste I reference Elements(Key) to grab all the object's information. This works fine, BUT if I want to copy elements from one instance of my application to another, I am not sure how since the objects are local to the one instance and not the other. Is there a way to pass objects between instances of my application? Thanks!
-
Oct 26th, 2004, 10:14 AM
#2
Fanatic Member
One way is to serialize the object and store the data in the clipboard. When you paste into the other instance of your application you will have to deserialize your object. XML would be a nice serialization format.... This could even make it possible to paste your object into excel and have it automatically formatted to the excel cells. You could also paste it to notepad and have a readable copy....
-
Oct 26th, 2004, 12:58 PM
#3
Thread Starter
Fanatic Member
Do you know of a generic way to loop through each property (for each?) of an object to create an xml file? Any examples?
-
Oct 27th, 2004, 02:22 AM
#4
Fanatic Member
In .NET you can use reflection, but in vb6 you have to do everything yourself. The best thing is to declare a serializable interface with serialize and deserialize methods and do your xml manipulation in there. You will need to consider the effects of initialization code... ie. the code run in the class_initialize event... this could be tricky. Also note that you will basically have a different instance of the object, so events raised in the one application will not be trapped in the other application.
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
|