By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,579 Members | 1,765 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,579 IT Pros & Developers. It's quick & easy.

Copying objects that support ICloneable interface

P: n/a
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

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Venkat Venkataramanan" <th****@hotmail.com> schrieb
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?
--
Armin

Nov 20 '05 #2

P: n/a

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" <th****@hotmail.com>
| Sender: "Venkat Venkataramanan" <th****@hotmail.com>
| Subject: Copying objects that support ICloneable interface
| Date: Mon, 15 Sep 2003 06:18:55 -0700
| Lines: 26
| Message-ID: <08****************************@phx.gbl>
| 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
|
|

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.