J
Jürgen Müller
Hi, all.
I'm having a strange problem while writing custom server control.
The control works fine so far, but I wanted to add some features which
support the developer while using the control in the Visual Studio designer.
Therefore I've added a designer which extends ContainerControlDesigner...see
code fragment below.
Problem:
Sometimes the cast MyComponent c = (MyComponent)base.Component will throw an
exception - and sometimes not. I haven't found a reason for this. The type of
base.Component is MyComponent. I've checked this in the debugger. Even Visual
Studio shows me all properties of this type during debugging.
I've modified the code and read the value of c.MyProperty via reflection -
and it works...
Any ideas what might be wrong or what happens here?
Any help appreciated.
Reagrds
Jürgen
Code fragment:
public class MyDesigner : ContainerControlDesigner
{
public override string FrameCaption {
get
{
MyComponent c = (MyComponent)base.Component;
return "MyComponent - " + c.MyProperty;
}
}
I'm having a strange problem while writing custom server control.
The control works fine so far, but I wanted to add some features which
support the developer while using the control in the Visual Studio designer.
Therefore I've added a designer which extends ContainerControlDesigner...see
code fragment below.
Problem:
Sometimes the cast MyComponent c = (MyComponent)base.Component will throw an
exception - and sometimes not. I haven't found a reason for this. The type of
base.Component is MyComponent. I've checked this in the debugger. Even Visual
Studio shows me all properties of this type during debugging.
I've modified the code and read the value of c.MyProperty via reflection -
and it works...
Any ideas what might be wrong or what happens here?
Any help appreciated.
Reagrds
Jürgen
Code fragment:
public class MyDesigner : ContainerControlDesigner
{
public override string FrameCaption {
get
{
MyComponent c = (MyComponent)base.Component;
return "MyComponent - " + c.MyProperty;
}
}