> 1) I've had problems with using typeof to get a type at compile time that
> doesn't work at design time before. Can you explain why using
[quoted text clipped - 6 lines]
>
> compiles but has problems at run-time?
Could you be please more specific? What kind of problems at runtime
do you have?
> 2) I don't quite understand the suggestion for a reference. CustomEditor is
> defined in ClientLib and the control is in WebControlLib, therefore there
> must be a reference to ClientLib in the WebControlLib project, creating
> reference to WebControlLib from ClientLib would create an invalid reference.
> Do you mean something different by an *assembly* reference?
The point here is that your designer assembly (ClientLib) references your
control
assembly (WebControlLib), but your control assembly *doesn't* reference your
designer assembly. This way, the control assembly doesn't have the designer
assembly
as a dependence in its manifest, so it should be loaded and executed with no
problems
at runtime. At design time, when the VS.NET designer host instantiates your
control,
it will try to instantiate the designer based on its the type name, as
specified by the
EditorAttribute attribute. Therefore, the designer assembly has to be
available to the
executable, which devenv.exe.
Obviously, the designer has to communicate with the control somehow . If
they're in the
same assembly, they can use Friend (internal) methods. But if they're
separated *and*
the control assembly doesn't know anything about the designer (except its
string type name),
there must be some mechanism how the designer communicates with the control
being
designed. Because the designer assembly *does* reference the control
assembly, it can
use the control's public interface. If the designer wants to employ some
"nonpublic"
exchanges with the control during design time, I'd suggest defining an
EditorBrowsable(Never)-interface defined in the control's assembly, which
the designer
assembly could use. If you'd like to be secure, you could probably sign your
assemblies
and apply the StrongNameIdentityPermission to the designer-only interface
methods (as
explained in
http://msdn.microsoft.com/msdnmag/issues/04/04/SecurityBriefs/default.aspx),
but
I don't have practical experience with it.
HTH
Best regards,
Palo
---
http://dact.lamarvin.com/
AutoComplete component for WinForms applications. Easy to integrate, easier
to use!
http://www.vbinfozine.com/
An ordinary VB developer shares his own successes and failures