473,473 Members | 1,524 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Copying object properties

Hi. I've created a "numeric text box" that inherits from the TextBox
control. I've given it a Replace method that looks like this:

Public Sub Replace(ByVal TB As TextBox)

Me.Size = TB.Size
Me.Location = TB.Location

TB.Parent.Controls.Add(Me)
TB.Parent.Controls.Remove(TB)

End Sub

Callers can say NumericTextBox.Replace(NormalTextBox), which works
fine.

The thing is, instead of copying just the Size and Location properties
explicitly, what I'd like to do is iterate through the TB object's
properties and copy each of them from TB to Me. Is there a way to do
this? Thanks.
Nov 20 '05 #1
1 1279
Hi,
You will need to use Reflection and use the Propertyinfo class to get the
different proerties of a textbox and then get to its values.
Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
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...
8
by: Thomas Mlynarczyk | last post by:
Hi! If A is an object, then "B = A;" will just assign a reference. Isn't there a simple way to create an actual copy of A and assign that to B? Greetings, Thomas
3
by: sparks | last post by:
I was copying fields from one table to another. IF the var name starts with milk I change it to egg and create it in the destination table. It works fine but I want to copy the description as...
3
by: Jason | last post by:
Hi prolly a simple solution...how do i make a "copy" of an existing object eg object obj1 = new object(); object obj2 = obj1; if i change a property in obj2, it also changes obj1, since...
6
by: solex | last post by:
Hello, I am trying to use serialization to copy objects. The object in question "Institution" inherits from a parent object "Party" both are marked as <Serializable()>. Initially I can copy an...
0
by: Tony Vitonis | last post by:
I think this got lost, so I'm reposting: __________________________________ Hi. I've created a "numeric text box" that inherits from the TextBox control. I've given it a Replace method that...
3
by: Bob Jones | last post by:
Ok, I am curious if this can be done in C# 2.0 via some internal .net functionality or if I have to do a coversion myself such as a copy construtor or override the explicit operator. I have 3...
4
by: jerrygarciuh | last post by:
I discovered this by accident today. How should I get an object's data into another variable and make modifications without affecting the original object? // Example of problem // here is x,...
2
by: Josh Valino | last post by:
Hi, I'd like to take the style properties from one control and apply them all to the properties of another control, where they relate. The situation is this: I have a TreeView control, and...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.