Custom Controls lose their name at runtime Spy++/Automation (C#.Net)

I have various custom controls, such as Horizontal/vertical splitters, and other third party controls.  The problem is that Visual Studio's Spy++ and the White automation framework, are unable to obtain names from these components.

http://screencast.com/t/pctNZ94iwcW <-- Spy++ Screenshot, Selected component is a list box, which loses its name as well.

Can anyone tell me why they are missing?  And particularly, how to get them back?  perhaps there is a system setting/dev setting to retain it.  I have source project, and can alter the build if need be, though it would be best not to have to.
LVL 8
hpdvs2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
Were the controls put on the form at design-time?...or run-time?
0
Jacques Bourgeois (James Burger)PresidentCommented:
The Name is not automatic.

The Windows Form Editor generates code that fills in the Name property when you put a Control on the Form in design.

The same does not apply however when you add the controls through your code. This is probably what is happening there. Simply fill-in the Name property when you create the control through code.
0
hpdvs2Author Commented:
These are for components that are added at design time.  The all have names in the properties window.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

hpdvs2Author Commented:
This even includes ListView, as the screen shot shows on the highlighted record in the image.
0
Jacques Bourgeois (James Burger)PresidentCommented:
I just ran Spy++.

It does not display the name of the controls, but their Text property. Controls in which the Text property is not set display an empty string.
0
Jacques Bourgeois (James Burger)PresidentCommented:
This ones amuses me (maybe not you), so I fooled around a bit.

If you explore Spy++, you will see Caption in a few places, such as for searching, but never Name. Caption was used in the pre-.NET times for Text that is displayed but not editable by the user. I do not remember Name as a property of the controls at that time. I think it was only as an indication for the compiler. Somebody still working in VB6 might verify.

There does not seem to be a Text property in a UserControl or a ListView, but there is one, because UserControl inherits from Control. It has simply been hidden (look in help, it has the BrowsableAttribute set to False) because the designer of the class thought that it was useless. You can set the Text property of your UserControl in code even if it does not appear in IntelliSense. You will have to foor around a bit because IntelliSense will automatically enter something else, but you can edit the line afterward to keep Text alone. The control is then "captioned" as you want in Spy++.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hpdvs2Author Commented:
The problem is that many of these custom controls are from third party vendors.  So I cannot edit them.
0
hpdvs2Author Commented:
This has been out here for a while, and I have not found a better solution, It doesn't solve it the way I wanted, but it sounds like its just not possible in some general way.  The information just doesn't get translated along to the build.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.