Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / May 2008

Tip: Looking for answers? Try searching our database.

Inherit a VisualStudio 2008 generics form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Giorgio Parmeggiani - 09 May 2008 15:26 GMT
Hi

I have a form with a generic type, like this one:

public partial class BaseForm<T> : Form
{
/* ... */
}

Another form inherit my base form:

public partial class CustomForm : BaseForm<int>
{
/* ... */
}

Now the designer show me this exception:

The designer could not be shown for this file because none of the classes
within it can be designed. The designer inspected the following classes in
the file: CustomForm --- The base class 'BaseForm' could not be loaded.
Ensure the assembly has been referenced and that all projects have been
built.

How can i solve this problem in VisualStudio 2008?

Thank in advance
Wen Yuan Wang [MSFT] - 12 May 2008 09:41 GMT
Hello Giorgio,

According to your description, you got an error said generic form
("BaseForm") could not be loaded in designer mode. Correct? If I
misunderstood anything here, please don't hesitate to correct me.

I have reproduced the issue. As far as I know, VS IDE draws Form Designer
by reflecting assemble, and creates the instance by its default
constructor. But, we couldn't create constructor for Generic Class. This
results the issue when VS IDE try to create a instance of Generic form. The
issue only occurs on Form Designer Mode. If you run the project, I believe
the problematic form could work fine in runtime. This seems a limitation
with VS IDE Form Designer. I will perform further research to check if
there is any way to resolve the issue, and update you once I get any
information.

Thanks for your understanding. If you have any more concern, please feel
free to let us know. We are glad to assist you.

Have a great day,
Best regards,
Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Giorgio Parmeggiani - 12 May 2008 10:04 GMT
Hi Wen

Thank for your reply.

You have perfectly understood my problem.
I'm waiting for a possible solution

Regards
Giorgio

> Hello Giorgio,
>
[quoted text clipped - 42 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Wen Yuan Wang [MSFT] - 14 May 2008 12:53 GMT
Hello Giorgio,

Thanks for your waiting. I'm sorry, but this seems a limitation in VS IDE.
The form which inherits a generics form could work fine on Runtime,
however, failed in Designer Mode. I also tried it on VS 2005. The issue
still persists. It seems we lost the support in VS IDE Form Designer.
Because we cannot find any workaround so far, I have logged it in our
internal DB for product team to investigate. If you want to communicate
with our product team developer on this issue, you can also submit this
issue on our Connect Feedback Portal. Our developer will evaluate them
seriously and communicate with you directly on the issue
http://connect.microsoft.com/VisualStudio/
Thanks for your posting. This will benefit our product quality improvement
very much.

But I'm afraid this issue may not be fixed very soon. For urgent issues, I
suggest you can contact Microsoft CSS directly. If the problem is confirmed
to be a product bug, the case charge will be free. You can check
http://support.microsoft.com for regional support phone numbers.

Hope this helps. Please feel free to let us know if you have any more
concern. We are glad to assist you.

Thanks again for your understanding.
Best regards,
Wen Yuan

Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Wen Yuan Wang [MSFT] - 16 May 2008 10:29 GMT
Hello Giorgio,

This is Wen Yuan, again. The issue seems like a VS IDE limitation. So far,
my suggestion is changing the code to inherit Form class when designing. We
really apologize for any inconvenience this may accused. I just want to
check if there is anything we can help with on this issue. If you have any
more concern, please feel free to let us know. We are glad to assist you.

Thanks for your understanding.
Best regards,
Wen Yuan

Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Giorgio Parmeggiani - 18 May 2008 08:50 GMT
Thank for your reply

I have found a little workaround:
http://www.madprops.org/cs/blogs/mabster/archive/2006/09/19/Designing-Generic-Fo
rms.aspx


Regards

Giorgio

> Hello Giorgio,
>
[quoted text clipped - 18 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Wen Yuan Wang [MSFT] - 19 May 2008 11:52 GMT
Hello Giorgio,

Thanks for your reply and great solution. This is really a smart workaround
to the issue. Defining a class between GenericForm and new IntForm could
make VS IDE to recognize IntForm as a standard from. Thereby, we get Form
Designer support again. We really appreciate for your feedback. Other
community member in newsgroup may learn and benefit from your feedback. I
will also log this information in our Internal DB.

Sorry for any inconvenience this limitation may cause. If there is anything
you feel we can help with, please don't hesitate to let us know. It's my
pleasure to assist you.

Thanks again for your understanding.
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.