1
votes

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
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

1 Answers

0
votes

I have an indirect way to solve this, mostly like this:

  1. You can define a bool property, supposed it named Desiging, and its default value is set to true.
  2. You set Designing = false, when the application runs, in which the ActiveX is used.

Now, you can do something special in different modes.