473,804 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copying objects that support ICloneable interface

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).Cl one

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
2 2261
"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).Cl one

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

Hi Venkat,

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

After the statement foUser = CType(loUser, Users.Users).Cl one, 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+nh0exZISi jRq2WI1YOzo8jqA ==
| Newsgroups: microsoft.publi c.dotnet.langua ges.vb
| Path: cpmsftngxa07.ph x.gbl
| Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:137010
| NNTP-Posting-Host: tk2msftngxa12.p hx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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).Cl one
|
| 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3658
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
10
1763
by: Jax | last post by:
I dont seem to fully comprehend references to objects yet. Lets say for example I do this; Customer c = new Customer(); Customer c1 = c; I understand that if I change c1, I also change c as they are both referencing the same piece of data. But this isn't always the case it would seem. Sometimes I take a reference out, change it and then go
5
3120
by: Steve - DND | last post by:
Is there any way to easily deep copy an entire object? Maybe something with unsafe code to make a full and completely duplicated copy of an object with no reference ties to the original? I want everything copied, public, private, internal, events, etc... Thanks, Steve
6
3245
by: Andy | last post by:
Hello. I've got an issue with the ICloneable interface that makes me think I'm missing the advantages of it. My issue is that the implemented Clone method returns an object and not a strongly typed definition. This means that the class you create exposes a method that returns an object which the user of the class must cast.
5
1830
by: Bob Weiner | last post by:
This seems real simple but I don't know how to do it. Obviously, what I'm looking for isn't what I typed. I don't want the assignment operator in commit() and reset() to work by reference but System.Object doesn't have a copy or clone method available. I'm sure I'm missing something simple. public class MyProperty { private object currVal; private object newVal;
7
26466
by: Don | last post by:
Can anyone give me an example of implementing ICloneable to give a class I created a "Clone" method so I can make copies of objects. I have no idea where to begin with this. Thanks. - Don
1
2300
by: Rain | last post by:
Hi. Im a C# newbie, just want to ask how to implement the ICloneable.Clone.. Dont know how it works, would really appreciate it if someone could show a simple source sample of how to do this.. Thank you so much!
4
3040
by: jjkboswell | last post by:
I have an XSD which I have generated a class from using the xsd.exe tool. My XSD contains complex types within it, so that the generated class has member variables which are of types that are also defined in the XSD. I deserialize XML data into instances of that class, and serialize back to XML. So far so good. However, in my code I have the concept of wanting to create new copies of these deserialized objects and modifying some of...
2
19473
by: Nathan | last post by:
I'm working with Clone() for the first time, and noticed that you have to unbox the Clone of an object that implements ICloneable: MyObject var1 = new MyObject(); // Where MyObject implements ICloneable MyObject va3 = (MyObject)var1.Clone(); Does anyone know why the 2.0 framework doesn't include a Generic implementation of the ICloneable interface?
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.