Copying objects that support ICloneable interface

  • Thread starter Thread starter Venkat Venkataramanan
  • Start date Start date
V

Venkat Venkataramanan

Hello:

I have an object Users that implements the ICloneable
interface.

I am trying to pass an instance of this object, foUser
from one form into a second form ByRef.

Dim formLogin As New frmLogin(foUser)

The second form creates a local instance of this object.
When all the business rules are obeyed, I have the
following statement that copies this local copy to the
instance that was passed in Byref:

foUser = CType(loUser, Users.Users).Clone

But when the control gets passed to the first form, it
looses all the values.

Any ideas on what I may be doing wrong?

Thanks.

Venkat
 
Venkat Venkataramanan said:
Hello:

I have an object Users that implements the ICloneable
interface.

I am trying to pass an instance of this object, foUser
from one form into a second form ByRef.

Dim formLogin As New frmLogin(foUser)

The second form creates a local instance of this object.
When all the business rules are obeyed, I have the
following statement that copies this local copy to the
instance that was passed in Byref:

foUser = CType(loUser, Users.Users).Clone

But when the control gets passed to the first form, it
looses all the values.

Any ideas on what I may be doing wrong?

What does the constructor of frmLogin look like? Where and how did you
declare foUser? How do you pass the new object to the calling form?
 
Hi Venkat,

Can you show me how do you implement the Clone method of
ICloneable interface?

After the statement foUser = CType(loUser, Users.Users).Clone, does your
foUser get all the value of the loUser object?(Before returing to the first
form)

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Venkat Venkataramanan" <[email protected]>
| Sender: "Venkat Venkataramanan" <[email protected]>
| Subject: Copying objects that support ICloneable interface
| Date: Mon, 15 Sep 2003 06:18:55 -0700
| Lines: 26
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcN7i+nh0exZISijRq2WI1YOzo8jqA==
| Newsgroups: microsoft.public.dotnet.languages.vb
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:137010
| NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Hello:
|
| I have an object Users that implements the ICloneable
| interface.
|
| I am trying to pass an instance of this object, foUser
| from one form into a second form ByRef.
|
| Dim formLogin As New frmLogin(foUser)
|
| The second form creates a local instance of this object.
| When all the business rules are obeyed, I have the
| following statement that copies this local copy to the
| instance that was passed in Byref:
|
| foUser = CType(loUser, Users.Users).Clone
|
| But when the control gets passed to the first form, it
| looses all the values.
|
| Any ideas on what I may be doing wrong?
|
| Thanks.
|
| Venkat
|
|
 
Back
Top