Re: How to back up an object...
- From: "Simon Verona" <news@xxxxxxxxxxxxxxx>
- Date: Tue, 12 Apr 2005 06:57:01 +0100
Thanks, I'll have to do that.
Regards
Simon
"Dennis" <Dennis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:13EFB6C4-3B62-4D36-82CE-6D42425BEF40@xxxxxxxxxxxxxxxx
> If the class is a "roll your own", you can add a Copy Property that uses
> "PropertyInfo" to copy all of the properties to a new instance of your
> class.
> If not roll your own, you can create a function to copy all the property
> values to a new instance of the class.
>
> "Simon Verona" wrote:
>
>> Well, I could do that, but I was slightly oversimplifying the problem, I
>> actually change a number of properties, so I thought I could get away
>> with
>> saving the whole object rather than each property individually...
>>
>> Regards
>> Simon
>> "JohnFol" <OutlookExpress@xxxxxxxxxxxxxxxx> wrote in message
>> news:SXw6e.17955$il.9389@xxxxxxxxxxxxxxxxxxxxxxx
>> > ok, I created a new form called Form1 with a single button on it,. The
>> > code is as follows
>> >
>> > Dim MyCopyForm As New Form1
>> >
>> > MyCopyForm.BackColor = BackColor.Bisque
>> >
>> > MyCopyForm.Show()
>> >
>> >
>> >
>> > This gives me the copy I was after. I think the problem you are having
>> > is
>> > you explicitly set the "copy" to point to the original. Just try
>> >
>> > Dim backup as dmsreport
>> > backup.font=newfont
>> > backup.print
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > "Simon Verona" <news@xxxxxxxxxxxxxxx> wrote in message
>> > news:OZdTPyqPFHA.2356@xxxxxxxxxxxxxxxxxxxxxxx
>> >> John
>> >>
>> >> I did try splitting the line into :
>> >>
>> >> dim backup as new dmsreport
>> >> backup=me
>> >>
>> >> but this seems to have the same affect.
>> >>
>> >> Regards
>> >> Simon
>> >> "JohnFol" <OutlookExpress@xxxxxxxxxxxxxxxx> wrote in message
>> >> news:ahw6e.17857$il.15981@xxxxxxxxxxxxxxxxxxxxxxx
>> >>> What happens if you use the New keyword?
>> >>>
>> >>>
>> >>> "Simon Verona" <news@xxxxxxxxxxxxxxx> wrote in message
>> >>> news:eo1ASRqPFHA.2584@xxxxxxxxxxxxxxxxxxxxxxx
>> >>>>I have a custom class inherited from a third party control.
>> >>>>
>> >>>> Within the class, I need to make a backup copy of the class so that
>> >>>> I
>> >>>> can change the properties (font size etc) for printing.
>> >>>>
>> >>>> So, I'm using code such as...
>> >>>>
>> >>>> Dim backup as dmsreport =me
>> >>>> backup.font=newfont
>> >>>> backup.print
>> >>>> etc etc
>> >>>>
>> >>>>
>> >>>> I was expecting this not to change any of the parameters of my
>> >>>> original
>> >>>> object, however I find that "backup" is created simply as a
>> >>>> reference
>> >>>> to "me" and therefore "me" contains all the updates I subsequently
>> >>>> make
>> >>>> to the backup.
>> >>>>
>> >>>> How do I make a copy of the object so that I can work on the copy
>> >>>> without changing the original?
>> >>>>
>> >>>> Hope that this makes sense!
>> >>>>
>> >>>> Regards
>> >>>> Simon
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>>
>>
.
- References:
- How to back up an object...
- From: Simon Verona
- Re: How to back up an object...
- From: JohnFol
- Re: How to back up an object...
- From: Simon Verona
- Re: How to back up an object...
- From: JohnFol
- Re: How to back up an object...
- From: Simon Verona
- Re: How to back up an object...
- From: Dennis
- How to back up an object...
- Prev by Date: Re: Accessing a Data Field
- Next by Date: Re: Urgent !! ---- How to add New menu options in File menu of Ms Word
- Previous by thread: Re: How to back up an object...
- Next by thread: Can't set focus to controls on TabPage
- Index(es):
Relevant Pages
|