468,247 Members | 1,431 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

Assign a namespace to a resource file in a Visual Basic project.

Please can you tell me how to assign a namespace to a resource file in a
Visual Basic project?

In C# such resources file inherit their namespace based upon the folder
hierarchy in which they are stored but in Visual Basic all such resources
appear in the project's default namespace. This is fine when there are just a
few resources but becomes cumbersome when there are lots.

Oct 29 '08 #1
6 5245
Hi Dick,

Thank you for using Microsoft Managed Newsgroup Service, my name is Zhi-Xin
Ye, I'm assigned to help you on this issue.

From your description, you mean VB.NET, right? If misunderstand you, please
let me know.

For VB.NET, it's a by design feature that all the global resource files
will be assigned to My.Resources namespace. However, you can name the
resources files in a manner that they're not corruptted.

For example, you can create a file structure like this:

--Resources
- Res1
+ Res1_Resource1.resx
+ Res1_Resource2.resx
+ Res1_Resource3.resx
- Res2
+ Res2_Resource1.resx
+ Res2_Resource2.resx
- Res3
+ Res3_Resource1.resx
+ Res3_Resource2.resx
+ Res3_Resource3.resx

If you have any problems or concerns, please feel free to let me know.

Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the

community or a Microsoft Support Engineer within 2 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. 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/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Oct 30 '08 #2
OK, by "design feature" I guess you mean "design flaw". I bet if I suggested
you dropped class namespaces and named all your classes in such a way you'd
think I was mad. In any case, you've answered my question and I'll therefore
stop looking for a way to do it, so thanks for that. Cheers.

"Zhi-Xin Ye [MSFT]" wrote:
Hi Dick,

Thank you for using Microsoft Managed Newsgroup Service, my name is Zhi-Xin
Ye, I'm assigned to help you on this issue.

From your description, you mean VB.NET, right? If misunderstand you, please
let me know.

For VB.NET, it's a by design feature that all the global resource files
will be assigned to My.Resources namespace. However, you can name the
resources files in a manner that they're not corruptted.

For example, you can create a file structure like this:

--Resources
- Res1
+ Res1_Resource1.resx
+ Res1_Resource2.resx
+ Res1_Resource3.resx
- Res2
+ Res2_Resource1.resx
+ Res2_Resource2.resx
- Res3
+ Res3_Resource1.resx
+ Res3_Resource2.resx
+ Res3_Resource3.resx

If you have any problems or concerns, please feel free to let me know.

Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the

community or a Microsoft Support Engineer within 2 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. 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/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Oct 30 '08 #3
"Dick" <Di**@nospam.nospamschrieb:
OK, by "design feature" I guess you mean "design flaw". I bet if I
suggested
you dropped class namespaces and named all your classes in such a way
you'd
think I was mad. In any case, you've answered my question and I'll
therefore
stop looking for a way to do it, so thanks for that.
In VB the namespace a resource file belongs to fortunately isn't tied to the
physical folder structure. Instead, you can specify the target namespace by
selecting the resource file and assigning the desired target namespace to
its "Namespace of the user-defined tool" (translated from the German version
of VS 2008) property in the properties window.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Oct 30 '08 #4
Hi Dick,

I'm sorry for the misleading.
Herfried is right. You can change the "Custom Tool Namespace" property for
the resource file to change its namespace.

Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

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:
ms****@microsoft.com.

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

Oct 31 '08 #5
Yup agreed, you can set this property, and of course I looked at this right
at the beginning of my research, but unless I'm mistaken, this doesn't apply
a namespace to the resource. Instead it simply saves a namespace to be used
later by a custom tool, but I don't think the compiler is a custom tool and
hence doesn't use the it. Perhaps you could demonstate it being used?

"Zhi-Xin Ye [MSFT]" wrote:
Hi Dick,

I'm sorry for the misleading.
Herfried is right. You can change the "Custom Tool Namespace" property for
the resource file to change its namespace.

Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

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:
ms****@microsoft.com.

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

Oct 31 '08 #6
"Dick" <Di**@nospam.nospamschrieb:
Yup agreed, you can set this property, and of course I looked at this
right
at the beginning of my research, but unless I'm mistaken, this doesn't
apply
a namespace to the resource. Instead it simply saves a namespace to be
used
later by a custom tool, but I don't think the compiler is a custom tool
and
hence doesn't use the it. Perhaps you could demonstate it being used?
I have tested it here in VS 2008 and it works automatically. Just take a
look at the namespaces and classes in object browser. The program
transforming the ResX files will emit the desired namespace based on the
property's value.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Oct 31 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Gabriel Lozano-Morán | last post: by
3 posts views Thread by Edward Diener | last post: by
6 posts views Thread by ryan.d.rembaum | last post: by
2 posts views Thread by frossberg | last post: by
4 posts views Thread by Jason Pettys | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.