M
Michal Semhric
Hello
I have an ActiveX (Basically an UserControl from Window.Forms
namespace)written C# (.NET 1.1) which is used in MS InfoPath for displaying
images.
The problem is that "sometimes" when constructor of my User control is called
I got an Exception (Specified cast is not valid).
The "sometimes" - I mean: the refresh in MS InfoPath caused by changing of
DOM where my ActiveX is binded. In normal cases like opening document the
ActiveX works perfect - no exception (see 2.).
My UserControl had set "Localizable" property to true so settings of
controls in my UserControl comes from embedded resources (See 1 and 2.):
1) //(from InitializeComponet method)
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(MyUserControl));
2) this.uiPictureBox.Location =
((System.Drawing.Point)(resources.GetObject("uiPictureBox.Location")));
//This is where Exception is thrown
The problem can NOT be in resource file because ActiveX live under normal
condition OK, but I strongly suspect ResourceManager, that under some (for me
unknown) conditions behaves that it has resources loaded, but attemt to cast
retrieved resources throws an Exception.
Thank You for Your reply
I have an ActiveX (Basically an UserControl from Window.Forms
namespace)written C# (.NET 1.1) which is used in MS InfoPath for displaying
images.
The problem is that "sometimes" when constructor of my User control is called
I got an Exception (Specified cast is not valid).
The "sometimes" - I mean: the refresh in MS InfoPath caused by changing of
DOM where my ActiveX is binded. In normal cases like opening document the
ActiveX works perfect - no exception (see 2.).
My UserControl had set "Localizable" property to true so settings of
controls in my UserControl comes from embedded resources (See 1 and 2.):
1) //(from InitializeComponet method)
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(MyUserControl));
2) this.uiPictureBox.Location =
((System.Drawing.Point)(resources.GetObject("uiPictureBox.Location")));
//This is where Exception is thrown
The problem can NOT be in resource file because ActiveX live under normal
condition OK, but I strongly suspect ResourceManager, that under some (for me
unknown) conditions behaves that it has resources loaded, but attemt to cast
retrieved resources throws an Exception.
Thank You for Your reply