Form Designer Breaks When Defined In Nested Namespace

G

Guest

I posted this in another forum, but nobody replied and I need an answer
fairly quickly:

I'm creating a Windows form application in VC++ .NET 2003. I'm creating the
UI is a nested namespace as follows:

namespace MyApplication
{
namespace GUI
{
//form class goes here
}
}

The above code breaks the form designer and generates the following error:

"The designer could not be shown for this file because none of the classes
within it can be designed."

However, when the form is not defined in a nested namespace, the form
designer works.

Does anybody know how to solve this issue?

Thanks!
 
G

Gary Chang[MSFT]

Hi,
namespace MyApplication
{
namespace GUI
{
//form class goes here
}
}

The above code breaks the form designer and generates the following error:

"The designer could not be shown for this file because none of the classes
within it can be designed.

I am afraid this is a known issue to the Visual C++ .NET 2003: to put a
form/control class in more than one level of namespace would be fine in
other .NET languages(e.g. C#), but in VC++ .NET 2003, it will no longer be
opened in the Designer window.

There is currently no way to do this in VS.NET 2003, but we have already
been working on this problem and will fix it in the next version--- Visual
Studio .NET 2005(Whidbey), so please keep an eye out for it in the future.

I appreciate your understanding and hope the above information helps, if
you have any issues or concerns please let me know. I will be happy to be
of further assistance.


Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thank you for your response. I am very disappointed that this (in my
opinion) MAJOR BUG slipped by and was released in production software. What
disappoints and suprises me even more is that Microsoft has not taken any
sort of measure to correct its problem via a hotfix or patch. I simply can
not wait for VS2005 to be released.

Are you aware of any workarounds? What I'm doing now is keeping them in
nested namespaces and then comment out the inner namespace when I need the
designer, which is very, very annoying on multiple forms.

Thanks!
 
P

Peter Bromley

I worked around this problem by using a set of macros

#if _DEBUG
//#define MYAPP_GUI
//#define MYAPP_GUI_NAMESPACE
#define END_MYAPP_GUI_NAMESPACE
#define MYAPP_GUI_RESOURCES(s) \
(System::String::Concat(S"MYAPP_GUI.", s))
#else
#define MYAPP_GUI MyApplication::GUI
#define MYAPP_GUI_NAMESPACE MyApplication { namespace GUI
#define END_MYAPP_GUI_NAMESPACE }
#define MYAPP_GUI_RESOURCES(s) \
(System::String::Concat(S"MyApplication.GUI.", s))
#endif

and then use them in .h and .cpp files like

namespace MYAPP_GUI {

__gc class MyClass
{
MYAPP_GUI::MyOtherClass* control;

void SomeFunc(void)
{
ResourceManager* resource = new
ResourceManager(MYAPP_GUI_RESOURCES(S"MyClass.Strings");
}
}

} END_MYAPP_GUI_NAMESPACE

Your Managed Resources build properties do need massaging as the
designer writes these explicitly when creating a resx file.

It's not a nice approach, it's not very clean, it needs some care and
feeding, but it does get me by without having to continually change code
to use the designer and it is mostly forward conpatible with VS2005 when
this problem gets fixed.

HTH.
 
G

Gary Chang[MSFT]

Hi,

I do understand your consern on this issue, however at this time we only
have covered it in Whidbey, if you want a resolution or a hotfix for VS.NET
2003, I suggest you can contact our PSS support engineers to work with you.
This may need you submit a support incident in Microsoft PSS (Product
Support Service). As a MSDN subscriber, you have two free support
incidents.

By the way, if the problem is confirmed by Microsoft PSS as a product
issue, PSS won't charge money. Every MSDN subscriber has two free support
incidents. You could use one of them to contact Microsoft PSS. So you don't
need to pay money yet. Surely if the issue is a product issue, you still
have two free support incidents.

For your reference, I attached steps to contact Microsoft PSS here: You can
contact Microsoft Product Support directly to discuss additional support
options you may have available, by contacting us at 1-(800)936-5800 or by
choosing one of the options listed at
http://support.microsoft.com/d-efault.aspx?scid=fh;EN-US;Offe-rProPhone

If there is anything unclear, please feel free to post here. We are glad to
be of assistance.

Meantime, I noticed the community member Peter has already suggested a
workaround of this problem, I wish it could also help you on this issue.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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