PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Easier way to expose properties?

Reply

Easier way to expose properties?

 
Thread Tools Rate Thread
Old 21-05-2006, 09:30 AM   #1
ljh
Guest
 
Posts: n/a
Default Easier way to expose properties?


I am using some 3rd party controls to create my own control.

I want to "pass up" many (but not all) of the properties of the 3rd party
controls that I am using to make my control, so that the end user can
customize as much or as little as they wish. But, there are HUNDREDS of
properties (of the combined controls).

Is there an easy way to expose the properties of the controls that I am
using to make my control adn still be able to block the very few properties
that (if set wrong) may make my control act up?





  Reply With Quote
Old 21-05-2006, 10:06 AM   #2
Tasos Vogiatzoglou
Guest
 
Posts: n/a
Default Re: Easier way to expose properties?

The first solution (politically correct) would be to provide accessors
to all the interested properties. The second solution (also politcially
correct) would be to subclass the original component and hide the
properties you don't want.

There is also a third solution, but it's a bit hackish ... By using
reflection you can create a method SetProperty(string name, object
value) and set the values of the properties. There you can check for
properties you don't want to change.

Regards,
Tasos

  Reply With Quote
Old 22-05-2006, 12:37 PM   #3
cody
Guest
 
Posts: n/a
Default Re: Easier way to expose properties?

what is wrong with

myComponent.MySubComponent.Property = newValue;

This way you do not need to program the properties again.
There also might be tools/codegenerators which might be able to automatize
the generation of properties for you. If not, you can easily generate a code
generator by yourself using reflection.

--


"ljh" <Some@where.else> schrieb im Newsbeitrag
news:_xVbg.41011$QU3.12460@bignews8.bellsouth.net...
>I am using some 3rd party controls to create my own control.
>
> I want to "pass up" many (but not all) of the properties of the 3rd party
> controls that I am using to make my control, so that the end user can
> customize as much or as little as they wish. But, there are HUNDREDS of
> properties (of the combined controls).
>
> Is there an easy way to expose the properties of the controls that I am
> using to make my control adn still be able to block the very few
> properties that (if set wrong) may make my control act up?
>
>
>
>
>



  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off