473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ 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 1280
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
3618
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
4619
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
2539
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
3803
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
2545
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
276
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
1388
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
1107
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
1154
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
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7287
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
7353
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...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
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...
0
5596
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,...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
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...

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.