Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 29th, 2004, 02:15 PM
Authorized User
 
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default Resources files

Hi

I'm trying to load an image from a resource file, The resource file is located in a folder in the root of the app. When I call the resource file VB generates the following error.

An unhandled exception of type 'System.Resources.MissingManifestResourceException ' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "IPS.Darwin.Resource.Image.resources" was correctly embedded or linked into assembly "Darwin".
baseName: IPS.Darwin.Resource.Image locationInfo: <null> resource file name: IPS.Darwin.Resource.Image.resources assembly: Darwin, Version=1.0.1520.21275, Culture=neutral, PublicKeyToken=null

Yet when I move the resource file to root of the app it works whats going on why can't I load the resource from the folder.

Code used to call resource within folder: (Does not work generates above error)
Dim asm As [Assembly] = [Assembly].GetCallingAssembly()

Dim rm As ResourceManager = New ResourceManager("IPS.Darwin.Resource.Image", asm)

picUserImage.Image = CType(rm.GetObject("UserImage"), Bitmap)

Yet when I move the resource file to the root and change the code it works
Dim asm As [Assembly] = [Assembly].GetCallingAssembly()

Dim rm As ResourceManager = New ResourceManager("IPS.Darwin.Image", asm)

picUserImage.Image = CType(rm.GetObject("UserImage"), Bitmap)

What's the difference?





Duncan
__________________
Duncan
 
Old February 29th, 2004, 03:02 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

So you have a directory called "Resources" where your resource files live? This doesn't implicitly change the full name of the resource however. As far as the run-time code is concerned, the resource is located at "IPS.Darwin.Image" within your project namespace. You could put the actual RESX file under /Resources/Resources/Resources and it wouldn't make a difference. When the resource is compiled, its name is based off the application root namespace.

You can put the RESX file in the sub directory, but still make the call to the new ResourceManager without the ".Resources" in it and it should work.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old March 1st, 2004, 05:59 AM
Authorized User
 
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter,

I sure I tried that, but anyway it now works thanks



Duncan





Similar Threads
Thread Thread Starter Forum Replies Last Post
Resources mike72 ASP.NET 2.0 Professional 0 January 3rd, 2006 08:25 AM
NewBie Resources spraveens Beginning PHP 3 February 17th, 2004 10:54 AM
Resources vijay VB.NET 2002/2003 Basics 2 November 3rd, 2003 11:25 AM
VS.Net Resources brthede VS.NET 2002/2003 3 June 11th, 2003 03:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.