Need help with property window for my new form class 
Author Message
 Need help with property window for my new form class

Hello,

I have designed a class that inherits from the base form class
(System.Windows.Forms.Form). One of the things that I need to implement
is to be able to associate, at design time, controls to a string. My
thought is that I need to create a class that implements IList and
ICollection and contains objects of another class that I will need to
create that just holds the string and the control.

My problem is, I've looked at an example from
http://www.*-*-*.com/
implement a collection that can be edited at design time, but I'm not
sure how to handle the controls. I can't seem to reference them ByRef in
a property and I don't know how to provide the ability to select from
*existing* controls on the form in the property editor for the
collection. Also, I would *really* like to avoid writing my own property
editor.

Can anyone give me some advice or point me to an example of this? If
it's in VB.NET that would be even better. The example mentioned above is
in C#, which I can decipher, but I've never used C# and it's been a few
years since C++.

        Thanks!
           -Tom.



Sat, 08 Jan 2005 09:41:27 GMT  
 Need help with property window for my new form class
Are you looking to create a collection as a member of a your custom control,
add controls to the collection at design-time and edit their properties in
the collection editor?  I hope I get you predicament . . . .

I would  . . .

a) create a new object called "MyMember" with one property called
"Component" (of type say IComponent)
b) create a strongly typed collection class called "MyMembers" which stores
only MyMember objects (above)

Now the custom collection editor will allow you to add MyMember object to
the MyMembers collection.  Once this is done the "Component" property of the
new member should be able to be dropped down and any component on the form
(anything derived from IComponent) should be able to be selected as the
component.  What you MyMember class does after that is up to you.

Hope this helps.

BigDave, Sydney Australia



Quote:
> Hello,

> I have designed a class that inherits from the base form class
> (System.Windows.Forms.Form). One of the things that I need to implement
> is to be able to associate, at design time, controls to a string. My
> thought is that I need to create a class that implements IList and
> ICollection and contains objects of another class that I will need to
> create that just holds the string and the control.

> My problem is, I've looked at an example from
> http://www.codeproject.com/useritems/ImageListBox.asp that shows how to
> implement a collection that can be edited at design time, but I'm not
> sure how to handle the controls. I can't seem to reference them ByRef in
> a property and I don't know how to provide the ability to select from
> *existing* controls on the form in the property editor for the
> collection. Also, I would *really* like to avoid writing my own property
> editor.

> Can anyone give me some advice or point me to an example of this? If
> it's in VB.NET that would be even better. The example mentioned above is
> in C#, which I can decipher, but I've never used C# and it's been a few
> years since C++.

> Thanks!
>    -Tom.



Sat, 08 Jan 2005 14:30:33 GMT  
 Need help with property window for my new form class
P.S. the designtime newsgroup is better suited to this question.



Quote:
> Hello,

> I have designed a class that inherits from the base form class
> (System.Windows.Forms.Form). One of the things that I need to implement
> is to be able to associate, at design time, controls to a string. My
> thought is that I need to create a class that implements IList and
> ICollection and contains objects of another class that I will need to
> create that just holds the string and the control.

> My problem is, I've looked at an example from
> http://www.codeproject.com/useritems/ImageListBox.asp that shows how to
> implement a collection that can be edited at design time, but I'm not
> sure how to handle the controls. I can't seem to reference them ByRef in
> a property and I don't know how to provide the ability to select from
> *existing* controls on the form in the property editor for the
> collection. Also, I would *really* like to avoid writing my own property
> editor.

> Can anyone give me some advice or point me to an example of this? If
> it's in VB.NET that would be even better. The example mentioned above is
> in C#, which I can decipher, but I've never used C# and it's been a few
> years since C++.

> Thanks!
>    -Tom.



Sat, 08 Jan 2005 14:31:04 GMT  
 Need help with property window for my new form class
Thanks for the advice. I was using the Control class as the property for
my item class. I'll change that to Component and see what I get.

I wasn't aware that there was a designtime newsgroup and I can't seem to
find it. Do you know what the complete name is?

        Thanks!
           -Tom.


Quote:
> Are you looking to create a collection as a member of a your custom control,
> add controls to the collection at design-time and edit their properties in
> the collection editor?  I hope I get you predicament . . . .

> I would  . . .

> a) create a new object called "MyMember" with one property called
> "Component" (of type say IComponent)
> b) create a strongly typed collection class called "MyMembers" which stores
> only MyMember objects (above)

> Now the custom collection editor will allow you to add MyMember object to
> the MyMembers collection.  Once this is done the "Component" property of the
> new member should be able to be dropped down and any component on the form
> (anything derived from IComponent) should be able to be selected as the
> component.  What you MyMember class does after that is up to you.

> Hope this helps.

> BigDave, Sydney Australia



> > Hello,

> > I have designed a class that inherits from the base form class
> > (System.Windows.Forms.Form). One of the things that I need to implement
> > is to be able to associate, at design time, controls to a string. My
> > thought is that I need to create a class that implements IList and
> > ICollection and contains objects of another class that I will need to
> > create that just holds the string and the control.

> > My problem is, I've looked at an example from
> > http://www.codeproject.com/useritems/ImageListBox.asp that shows how to
> > implement a collection that can be edited at design time, but I'm not
> > sure how to handle the controls. I can't seem to reference them ByRef in
> > a property and I don't know how to provide the ability to select from
> > *existing* controls on the form in the property editor for the
> > collection. Also, I would *really* like to avoid writing my own property
> > editor.

> > Can anyone give me some advice or point me to an example of this? If
> > it's in VB.NET that would be even better. The example mentioned above is
> > in C#, which I can decipher, but I've never used C# and it's been a few
> > years since C++.

> > Thanks!
> >    -Tom.



Sat, 08 Jan 2005 20:12:32 GMT  
 Need help with property window for my new form class
It helped a great deal. I now have things working pretty much like I
wanted them to work. I still have some testing to do, but it was a nice
jump forward. Thanks again!

        -Tom.


Quote:
> Are you looking to create a collection as a member of a your custom control,
> add controls to the collection at design-time and edit their properties in
> the collection editor?  I hope I get you predicament . . . .

> I would  . . .

> a) create a new object called "MyMember" with one property called
> "Component" (of type say IComponent)
> b) create a strongly typed collection class called "MyMembers" which stores
> only MyMember objects (above)

> Now the custom collection editor will allow you to add MyMember object to
> the MyMembers collection.  Once this is done the "Component" property of the
> new member should be able to be dropped down and any component on the form
> (anything derived from IComponent) should be able to be selected as the
> component.  What you MyMember class does after that is up to you.

> Hope this helps.

> BigDave, Sydney Australia



Sat, 08 Jan 2005 21:15:59 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Using Forms in Classes (beginner w/ classes needs help)

2. Dim obj As New Class crt Dim Obj As Class = New Class

3. Setting OCX Property on MDI Child form causes new form to open

4. Help - Need newer version of Windows Message

5. create new property in a class

6. Need help with raising event in New() event in a base form

7. New VB user need help with API's and Splash Forms

8. Need some help with form properties

9. Need some help with form properties

10. Need some help with form properties

11. need help with BackColor property of a Form ?1

12. Need help with Moveable property of forms

 

 
Powered by phpBB® Forum Software