PC Review


Reply
Thread Tools Rate Thread

Cloning an object

 
 
meh
Guest
Posts: n/a
 
      22nd Feb 2004
ya know I thought that if I added a new Tabpage and then assigned it to an
existing tabpage that I would get a clone of the Tabpage......i.e.
Dim tp As New TabPage()

tp = TabPage1

Me.TabControl.TabPages.Add(tp)

But this is not giving me the results I expected. Is the TabPage not an
object in and of itself????


ne thoughts

tia
meh




 
Reply With Quote
 
 
 
 
Rob Teixeira [MVP]
Guest
Posts: n/a
 
      22nd Feb 2004
Object variables are just handles/refrences to the actual object ( a blob of
memory representing the object's data ).
When you assign one reference to another, you don't clone the object, you
get two references that point at the same object.

-Rob Teixeira [MVP]

"meh" <(E-Mail Removed)> wrote in message
news:e$t8wIX%(E-Mail Removed)...
> ya know I thought that if I added a new Tabpage and then assigned it to an
> existing tabpage that I would get a clone of the Tabpage......i.e.
> Dim tp As New TabPage()
>
> tp = TabPage1
>
> Me.TabControl.TabPages.Add(tp)
>
> But this is not giving me the results I expected. Is the TabPage not an
> object in and of itself????
>
>
> ne thoughts
>
> tia
> meh
>
>
>
>



 
Reply With Quote
 
meh
Guest
Posts: n/a
 
      22nd Feb 2004
Thx Rob
I guess I was thinking in terms of child forms in a MDI app. i.e.
Dim child1 As New frmChild()

Which (i think) is a copy of all the forms objects........

I was trying to do a similar thing with the TabPage in that as I needed a
new TabPage I wanted to get a duplicate if the boilerplate tabpage.

I'm sorry if these questions are too elementary but I keep thinking I'm on
verge of getting this....:-)

Can someome point me in the right direction...

tia

meh

"Rob Teixeira [MVP]" <RobTeixeira@@msn.com> wrote in message
news:uSi%2314X%(E-Mail Removed)...

> Object variables are just handles/refrences to the actual object ( a blob

of
> memory representing the object's data ).
> When you assign one reference to another, you don't clone the object, you
> get two references that point at the same object.
>
> -Rob Teixeira [MVP]
>
> "meh" <(E-Mail Removed)> wrote in message
> news:e$t8wIX%(E-Mail Removed)...
> > ya know I thought that if I added a new Tabpage and then assigned it to

an
> > existing tabpage that I would get a clone of the Tabpage......i.e.
> > Dim tp As New TabPage()
> >
> > tp = TabPage1
> >
> > Me.TabControl.TabPages.Add(tp)
> >
> > But this is not giving me the results I expected. Is the TabPage not an
> > object in and of itself????
> >
> >
> > ne thoughts
> >
> > tia
> > meh
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Rob Teixeira [MVP]
Guest
Posts: n/a
 
      23rd Feb 2004
The line with the New statement was correct.
All i'm saying is that the following line where you set one reference equal
to the other, does not clone.

Keep at it. It'll make sense soon :-)

-Rob Teixeira [MVP]

"meh" <(E-Mail Removed)> wrote in message
news:uNDefLY%(E-Mail Removed)...
> Thx Rob
> I guess I was thinking in terms of child forms in a MDI app. i.e.
> Dim child1 As New frmChild()
>
> Which (i think) is a copy of all the forms objects........
>
> I was trying to do a similar thing with the TabPage in that as I needed a
> new TabPage I wanted to get a duplicate if the boilerplate tabpage.
>
> I'm sorry if these questions are too elementary but I keep thinking I'm on
> verge of getting this....:-)
>
> Can someome point me in the right direction...
>
> tia
>
> meh
>
> "Rob Teixeira [MVP]" <RobTeixeira@@msn.com> wrote in message
> news:uSi%2314X%(E-Mail Removed)...
>
> > Object variables are just handles/refrences to the actual object ( a

blob
> of
> > memory representing the object's data ).
> > When you assign one reference to another, you don't clone the object,

you
> > get two references that point at the same object.
> >
> > -Rob Teixeira [MVP]
> >
> > "meh" <(E-Mail Removed)> wrote in message
> > news:e$t8wIX%(E-Mail Removed)...
> > > ya know I thought that if I added a new Tabpage and then assigned it

to
> an
> > > existing tabpage that I would get a clone of the Tabpage......i.e.
> > > Dim tp As New TabPage()
> > >
> > > tp = TabPage1
> > >
> > > Me.TabControl.TabPages.Add(tp)
> > >
> > > But this is not giving me the results I expected. Is the TabPage not

an
> > > object in and of itself????
> > >
> > >
> > > ne thoughts
> > >
> > > tia
> > > meh
> > >
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I code the cloning of an object in vba? sarndt Microsoft Excel Programming 1 17th Mar 2010 07:05 PM
Cloning an object which contains a collection deltaquattro Microsoft Excel Programming 0 17th Mar 2010 04:11 PM
Why deep cloning? Why shallow cloning? How is this related to references? raylopez99 Microsoft C# .NET 3 6th Aug 2007 09:30 AM
XPe cloning (using Microsoft Cloning stuff or Nortons Ghost) heath holcomb Windows XP Embedded 3 12th Mar 2004 09:13 PM
Re: cloning one system's boot drive using another system as a cloning host? Thomas O'Grady [MSFT] Microsoft Windows 2000 Security 1 25th Jul 2003 06:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:32 PM.