Control Won't Open in Designer

  • Thread starter Thread starter BluDog
  • Start date Start date
B

BluDog

Hi

I have a Custom User Control that appears in the solution explorer
with the standard class/module icon rather than the control icon. When
i open it, only the code is available, the control will not load in
design mode.

The control works fine at runtime and i have no problems with other
custom controls. Does anyone know what can cause this?

Thanks

Blu.
 
Has this happened sudenly or have you made a modification to the control.
You could try removing it then re-adding to the project/solution
 
Has this happened sudenly or have you made a modification to the control.
You could try removing it then re-adding to the project/solution

It happens regularly on this particular control. If i copy the code
from it and add it into new UserControl it sorts it for a bit, then
something triggers it to start playing up again. I've not managed to
work out what that trigger is.

Cheers

Blu
 
The only other suggestion I have is to check your dependencies and perhaps
experiment a little.
 
Chances are, there really is some problem code in the control and it's
probably code that's not intended to be executed at design time.

To debug the control, open a second instance of .net ide, select
tools->debug processes and attach to devenv. In the 2nd instance, set
debug->exceptions to break on all CLR errors. Then in the first
instance, attempt to open the problem control in the designer and the
second instance of ide should break at the point where your control's
code is breaking.

If indeed you have code that should only be run at design time, using
DesignMode property always returns false (it doesn't work as expected)
so the solution i've used is to override the DesignMode property with
this code:
public new bool DesignMode
{
get
{
return (Process.GetCurrentProcess().ProcessName ==
"devenv");
}
}

This is specific to design mode in vs.net, though...

good luck,
Art Gaisin
 
Chances are, there really is some problem code in the control and it's
probably code that's not intended to be executed at design time.

To debug the control, open a second instance of .net ide, select
tools->debug processes and attach to devenv. In the 2nd instance, set
debug->exceptions to break on all CLR errors. Then in the first
instance, attempt to open the problem control in the designer and the
second instance of ide should break at the point where your control's
code is breaking.

If indeed you have code that should only be run at design time, using
DesignMode property always returns false (it doesn't work as expected)
so the solution i've used is to override the DesignMode property with
this code:
public new bool DesignMode
{
get
{
return (Process.GetCurrentProcess().ProcessName ==
"devenv");
}
}

This is specific to design mode in vs.net, though...

good luck,
Art Gaisin


Thanks Art, that's a very useful trick, not tried it yet (the control
is behaving at the moment). As soon as it vanishes again I'll have a
go.

Cheers

Blu
 
Back
Top