all groups > dotnet windows forms designtime > november 2006 >
You're in the

dotnet windows forms designtime

group:

Issue with Custom Designers.


Issue with Custom Designers. Speed
11/9/2006 5:35:20 AM
dotnet windows forms designtime:
I have a custom designer derived from the parentcontroldesigner for a
usercontrol. I derive another control from this user control, it
compiles fine and when I put this control on to a form I get an error
message saying that the "Invalid Cast Exception". So I am wondering y
cannot we derive from usercontrols which have custom designers.
The sample outline of the code is as:

[Designer(typeof(CustomDesigner))]
public class myusercontrol : UserControl
{
......
......
}

internal class CustomDesigner:ParentControlDesigner
{
myusercontrol myc;
public override Initialize(Icomponent component)
{
base.Initialize(component);
myc = componenet as myusercontrol; //invalid cast exception.
.......
}
}

//derived control

public class derivedfromMyUserControl : myusercontrol
{
.......
}
Re: Issue with Custom Designers. Bryan Phillips
1/15/2007 11:38:29 AM
I was unable to reproduce your problem. Can you post the actual code
you are using?

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com



[quoted text, click to view]
AddThis Social Bookmark Button