Support for Generics in Forms and Controls

C

Chuck Cobb

I just discovered the hard way that the Visual Studio designer for forms and
controls does not support generics.

I created the following controls:

Base Class:
public partial class CtlDataGrid<CollectionClass, InfoClass> : CtlBase
where CollectionClass : BaseCollection<InfoClass>
where InfoClass : BaseInfo
{

Primary Class:
public partial class CtlConsultantDatabase :
CtlDataGrid<ConsultantCollection, ConsultantInfo>

Everything works fine...the application compiles and runs fine, but when I
attempt to open the primary control in the designer, I get an error that
says the base control cannot be built.

Is there a work-around for this problem? Is there a plan to support
generics with forms and controls in the future?

Thanks,

Chuck Cobb
 
G

gxtsh75

Yeah, I met the same problem.

It seems that the form designer doesn't support generic.

when use generic in a form class, compile and run is ok, but it can not be
designed.
 
A

A.Cicak

Yeah, its big problem, we have to take completely different approach (much
worse) because of this. I tried "hack" by renaming base classes whenever I
want to go to design but it is just not worth the effort (although "worth"
here means a lot). Did anyone got response from MS, is there
some workaround for this?
 
A

A.Cicak

Yeah, its big problem, we have to take completely different approach (much
worse) because of this. I tried "hack" by renaming base classes whenever I
want to go to design but it is just not worth the effort (although "worth"
here means a lot). Did anyone got response from MS, is there
some workaround for this?



--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top