I have a .Net usercontrol exposed as ActiveX control. Now I want to provide localization/globalization to this control based on the user choice. What I did was I have added a property named "Language" in the COM interface so that user can set the language during design time when this ActiveX control is placed on a contrainer (like VB6 form). I need to access this design time property "Language" in ActiveX control/Usercontrol constructor during runtime so that I can set the UI thread culture to appropriate culture. But my problem is I am unable to access this design time property in constructor during runtime as its parent I mean usercontrol/ActiveX control is still under construction. Is there any way to access design time property during runtime that too in constructor?
1
votes
Since the control is constructed first and then it's properties are set I wouldn't have thought so. Usually a control responds to the property being set/changing and runs the appropriate code at that point.
– James Barrass
This is a pretty fundamentally wrong way to go about it. You cannot just change the thread's culture, that will affect everything, not just your .NET code. It is an unmanaged property of a thread. It is the opposite, the culture will already be set to the user's language. The first chance you got to see the assigned value of a property is in its setter.
– Hans Passant