CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2000
    Posts
    48

    Copy User defined type

    Hello, i have got an user defined type and would like to copy it into another type. I would like to have a copy and not a reference! Has anybody got a solution?
    Type Address1
    Name
    Age
    End Type

    Dim Address1 As Address
    Dim Address2 As Address

    Address1.Name = A
    Address1.Age = 2

    Address2=Address1

    If I now change the name of Address2 the name of Address1 changes, too (byref).
    I would like to have a copy!
    Thanks






  2. #2
    Join Date
    Sep 2001
    Location
    Montreal Canada
    Posts
    1,080

    Re: Copy User defined type

    instead of using Equal you might want to do a class with the user defined type and add a method copy..

    It should work that way. that copy returns a New object of that type.

    Or you may wanna try this

    Address2.Name = Address1.name
    Address2.Age = Address1.Age




    Nicolas Bohemier

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured