Tian:
Thank you for your response. Your understanding is absolutely correct, but
if you alter your steps just slightly, you'll see my problem.
Try this:
1. Create a Windows Control Library project
2. Instead of adding an Inherited User Control, just add a class
3. Make the class inherit from the text box
4. No joy.
Now, I had previously noticed the behavior that you have outlined.
Originally, I thought that I would work around the problem by doing exactly
what you are doing in your steps: starting with a UserControl descendant
and then changing its inheritance. Unfortunately, that doesn't seem to work
so well over time.
I find that while I am developing the control, there are certain actions
that I can do (sorry, haven't figured out which) that will cause VS.Net to
reevalute the controls in MyControls. When that happens, it "notices" that
some of the controls are no longer descending from UserControl, and they get
removed.
When that happens, if I go back and change them to descend from usercontrol,
and then I can get them to reappear on the toolbox. Then I can change them
back, and they remain on the toolbox -- for a while, until I do whatever it
is that causes VS.net to reevaluate them and remove them again.
When I began the project, and only had a couple of controls in the library;
it was only a minor annoyance. Now I have more controls, and it's becoming
gradually more painful.
I was hoping that perhaps there is an attribute or something that I can
temporarily apply to my controls to cause them to always be loaded into
MyControls. (or even some other toolbox page)
[quoted text, click to view] "Tian Min Huang" <timhuang@online.microsoft.com> wrote in message
news:8TrBmSW5DHA.1512@cpmsftngxa07.phx.gbl...
> Hello,
>
> Thanks for your post. As I understand, the problem you are facing is that
a
> control which is not inherited from UserControl is not listed in the "My
> User Controls" Toolbox. Please correct me if there is any
misunderstanding.
> I tested on my side, however, I am not able to reproduce the problem on my
> side. The following is what I did:
>
> 1. Create a "Windows Control Library" project.
> 2. Build the project.
> 3. Add an "Inherited User Control" (UserControl2) which derived from
> UserControl1.
> 4. Add an "User Control" (UserControl3), modify the code to let it
> inherited from TextBox and comment out the code relating to
> UserControl3_Load.
> public class UserControl3 : System.Windows.Forms.TextBox
> 5. Build the project.
> 6. Add a Windows Form to the project, the UserControl1, UserControl2 and
> UserControl3 are listed in "My User Controls" and I am able to add them to
> the Form.
>
> Please check it on my side. I look forward to your result.
>
> Regards,
>
> HuangTM
> Microsoft Online Partner Support
> MCSE/MCSD
>
> Get Secure! --
www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights.
>