Dan Violet Sagmiller (He/Him)
asked on
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.
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.
Were the controls put on the form at design-time?...or run-time?
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.
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.
ASKER
These are for components that are added at design time. The all have names in the properties window.
ASKER
This even includes ListView, as the screen shot shows on the highlighted record in the image.
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The problem is that many of these custom controls are from third party vendors. So I cannot edit them.
ASKER
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.