Re: How to back up an object...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>>
>>


.



Relevant Pages

  • Re: Looking after guinea pigs through the winter
    ... Regards, ... Are there any minimum temperatures we need ot be aware of. ... > Simon Mc ... > (remove GLOVES to reply) ...
    (uk.rec.pets.misc)
  • Re: Rollup 2
    ... Loxy wrote: ... All worked well apart from the "My Pictures" section, as previously stated and the lack of TV. Managed to find that I need an MPEG2 decoder to cure the latter, but don't wish to install same until I have the latest roll up updates, if they are needed. ... Should I reinstall it again or is there another one to supercede it which will not cause the proble of opening MC up again? ...
    (microsoft.public.windows.mediacenter)
  • Re: in the USA - The Southern Part
    ... Regards ... Simon ... >>The problem with metricism is the EU, ... >>than lb/oz etc) than it is to simply declare what the metric scales are ...
    (comp.databases.pick)
  • Re: BBC Micro Floppy Drive Power Cable PIN Out
    ... Regards, ... Simon ... >> the plastic housing and I am unsure which pin goes where, ... >> housing has holes for up to six pins of which only 3 are used). ...
    (comp.sys.acorn.hardware)
  • Re: How to sync my pst file in laptop to Outlook in PC programatically?
    ... I work through the whole folder tree recursively? ... Simon ... > All in all that´s no easy job! ... > Viele Gruesse / Best regards ...
    (microsoft.public.outlook.program_vba)