PC Review


Reply
Thread Tools Rate Thread

Add properties to a control at Run-Time?

 
 
Özden Irmak
Guest
Posts: n/a
 
      9th Mar 2005
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


 
Reply With Quote
 
 
 
 
Tiansong Pu
Guest
Posts: n/a
 
      9th Mar 2005
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:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
J L
Guest
Posts: n/a
 
      9th Mar 2005
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
>


 
Reply With Quote
 
Özden Irmak
Guest
Posts: n/a
 
      13th Mar 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Design time properties on control =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?= Microsoft Dot NET Framework Forms 1 16th Mar 2007 02:02 PM
Add properties to a control at Run-Time? Özden Irmak Microsoft C# .NET 3 13th Mar 2005 01:45 PM
Can I change more than one control's properties at the same time? Mike Chan Microsoft VB .NET 15 3rd Feb 2004 01:49 AM
design time control properties Paul Microsoft Access Forms 4 9th Jan 2004 04:08 PM
how to set control properties at run time? Tim Mackey Microsoft ASP .NET 0 2nd Dec 2003 04:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:04 AM.