VB class copying

Programming, for all ages and all languages.
Post Reply
dh

VB class copying

Post by dh »

(fixed the title)

Basically I have a "Class in a variable"(tm) and I'm working on a "flush" function to remove all unused slots (unused being thoes declared to be "set Program_Threads(i) = nothing".) and pile thoes used starting a zero. This frees up some memory for other things.

The problem is I can't seem to find a way to copy one to another. (some variables are read-only and such) directly.

Thanks ahead (I know some people are thinking: "what the hell is this guy doing without knowing how to do <such and such>!!". well , I'm working in unknown (to me) territory (eg. graphics + classes, etc.))
dh

Re:VB class copying

Post by dh »

Anybody?

I'll try this: set x = new y
if you can't copy, please say so!!

Thanks
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:VB class copying

Post by Candy »

I think the reason for the amount of replies is that you ask about Visual Basic on a forum where half the visitors are OS developers (who mainly use system languages) and that the larger part of the other half are AGI/SGI developers, who are also a far way from Visual Basic.
dh

Re:VB class copying

Post by dh »

@candy: ok, understood.

@everyone else: i'm free to help in VB where others need it ;P

Thanks anyway
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:VB class copying

Post by distantvoices »

maybe this is of help?

http://www.devx.com/vb2themax/Tip/19437

or you google for:

visual basic object cloning.

because If I understand you correctly, you want to have two instances of the same class filled with the same content in memory. this has to be done via *deep* copying, say, each and every thing in the memoryarea allocated for the object is copied over to the newly created object's memory area.

Like in c: If you want to copy the content of one array into another one, you canna simply say a=b, because this only moves the first position from b to the first slot of a and thats it. Here you need to memcpy the content of b to a in the size of b. (ie: amount of slots * size of array data type)

Hope this makes the things a bit clearer.

btw: don't expect too much help from me, I'm not very deep into visual basic. have just done a few apps with it, mainly web services and soap stuff.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
dh

Re:VB class copying

Post by dh »

@BI: any help is good!!! I'll look into it. (You hit my meaning right on the dot!)

thanks again
Post Reply