473,396 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Add properties to a control at Run-Time?

Hi,

I've developed a couple of Windows Forms controls. To extend their
flexibility, in run-time, I should be able to define/add new properties for
those controls.

I know that Reflection.Emit namespace is for that purpose. I have searched
for possible examples about this and only found the ones which create the
assembly, module and properties (As a whole) from scratch. But I want to add
new properties to an existing Class?

Does anybody have any example about this? I need examples such as how to
retrieve mehtodbuilder from an exsiting class, etc. to add new properties?

Thanks in advance,

Özden
Jul 21 '05 #1
3 1133
You can create a new class inherited from the original class and add your
new properties.

Tiansong Pu

"Özden Irmak" <ozdenirmak(at)isnet.net.tr> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I've developed a couple of Windows Forms controls. To extend their
flexibility, in run-time, I should be able to define/add new properties for those controls.

I know that Reflection.Emit namespace is for that purpose. I have searched
for possible examples about this and only found the ones which create the
assembly, module and properties (As a whole) from scratch. But I want to add new properties to an existing Class?

Does anybody have any example about this? I need examples such as how to
retrieve mehtodbuilder from an exsiting class, etc. to add new properties?

Thanks in advance,

Özden

Jul 21 '05 #2
J L
Hi Ozden,
Check out this link:

http://msdn.microsoft.com/library/de...et04082003.asp

Shows the use of Extender Providers to add properties, etc. to
textboxes but could work with any control. Well written article and
the download shows the source code. I used it to develop my own text
validator using much of Mr. Hollis' ideas but changing the overall
behavior to suit my needs.

John

On Wed, 9 Mar 2005 10:15:36 +0200, "Özden Irmak"
<ozdenirmak(at)isnet.net.tr> wrote:
Hi,

I've developed a couple of Windows Forms controls. To extend their
flexibility, in run-time, I should be able to define/add new properties for
those controls.

I know that Reflection.Emit namespace is for that purpose. I have searched
for possible examples about this and only found the ones which create the
assembly, module and properties (As a whole) from scratch. But I want to add
new properties to an existing Class?

Does anybody have any example about this? I need examples such as how to
retrieve mehtodbuilder from an exsiting class, etc. to add new properties?

Thanks in advance,

Özden


Jul 21 '05 #3
Hi,

Thank you both for taking time and trying to help me...

I know I can extend a class by deriving from it and add my properties and I
also know Extender Providers to add properties to controls. But both of
these solutions are again static, I mean I hardcode which properties will be
added to my standart control. My problem was creating properties on the fly,
this means when I instance an object in my applicaiton, I add properties
into it and it becomes a modified class.

Anyway, I could find the solution at here :

http://www.codeproject.com/cs/miscct...g_property.asp

I hope it will be usefull for anybody in a situation like me...

Thanks again,

Özden

"J L" <jo**@marymonte.com> wrote in message
news:bh********************************@4ax.com...
Hi Ozden,
Check out this link:

http://msdn.microsoft.com/library/de...et04082003.asp

Shows the use of Extender Providers to add properties, etc. to
textboxes but could work with any control. Well written article and
the download shows the source code. I used it to develop my own text
validator using much of Mr. Hollis' ideas but changing the overall
behavior to suit my needs.

John

On Wed, 9 Mar 2005 10:15:36 +0200, "Özden Irmak"
<ozdenirmak(at)isnet.net.tr> wrote:
Hi,

I've developed a couple of Windows Forms controls. To extend their
flexibility, in run-time, I should be able to define/add new properties
for
those controls.

I know that Reflection.Emit namespace is for that purpose. I have searched
for possible examples about this and only found the ones which create the
assembly, module and properties (As a whole) from scratch. But I want to
add
new properties to an existing Class?

Does anybody have any example about this? I need examples such as how to
retrieve mehtodbuilder from an exsiting class, etc. to add new properties?

Thanks in advance,

Özden

Jul 21 '05 #4

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

Similar topics

8
by: Paul | last post by:
Hello, I've been reading up on security in Java Applets and whilst I understand the concept, I can't successfully get my applet to read a file on my local machine. I discovered from...
5
by: Jason Butera | last post by:
I know that I can read/write custom properties of an object by using the following: Setting: document.all.customProp = "this"; Getting: document.all.customProp; Is there a way I can run...
2
by: Joe | last post by:
OK, so i searched this forum, and it seems like my question has come close to being answered a dozen times, but never fully... I have a very simple control that inherits from UserControl. It has...
7
by: Donald Grove | last post by:
Is it possible to retrieve field properties from a table in access2000 using code? I have tried: " dim dbs as dao.database dim tbl as dao.tabledef dim fld as dao.field dim prop as...
2
by: Vivek Sharma | last post by:
Hi There, I have a situation where I wish to load the controls dynamically on the basis of user role. Hence, I am using this code. if (UserRole == "IS Administrator") { Control UC1 =...
2
by: Richard Brown | last post by:
Hi, I have a base class (which inherits from System.Web.UI.Page) for all the pages in my application. I have a property defined on this class that I want to set declaratively in the .aspx...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
5
by: ajk | last post by:
Hi I was wondering how one normally does to hide standard properties in a user control e.g. X,Y or Width. I have one approach where I have a base object which hides some of the properties and...
6
by: ajk | last post by:
Hi I was wondering how to show different properties in design and run-mode for a user control? Is it possible to do this when implementing the System.ComponentModel.ICustomTypeDescriptor...
2
by: menyki | last post by:
use visual.net to develope software, now i want to start using java. i have been able to install netbeans 5.5, my sql and jdk. i have been also able to drag control to jpane. my problems are, i find...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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
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
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,...

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.