Visual C# Developer Center >
Visual C# Forums
>
Visual C# IDE
>
Accessing Resources Fom Another Project Via The Properties Window
Accessing Resources Fom Another Project Via The Properties Window
- Is there a way to access resources that are in a resource file in another project using the Properties window in the IDE?
Background:
Visual Studio Team System 2008
Language: C#
Two projects in the solution: application project, library with user controls and common resources.
Say a new form is created in the application project. If I try to set the background image property from the properties window using an image in the common resources, there seems to be no way to specify that file as the source of the resources.
Is such a thing possible?
Answers
- Yeah, there's no way to do that from the IDE other than to manually edit the code. Sorry.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser- Marked As Answer byHerr Blitzkrieg Friday, October 30, 2009 5:09 PM
All Replies
- You wouldn't do that typically. Using the properties/resources window you can set the accessibility modifier of your resources within your class library, but you have to do that from the class library itself. There's a drop-down at the top of the page. After that, it's a simple matter of referencing it in code:
ClassLibrary1.Properties.Resources.SomeImage
In other words, when calling on the resource from the main application, you wouldn't use the resources of the main application, you would use the now public resources of the class library.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser Yes, in the class libary the resources are public and can be accessed from the code in either project by dereferencing the assembly just as you indicated. But I can't access the resources, specifically image resources, from Visual Studio Designer. It lets me import the image file into the control's local .resx file or it looks for a project local resource file. But I wish I could type into the image property field to dereference the resource but it won't let me do that either.
I guess ultimately the designer is generating code so it doesn't really matter who (me or the IDE) does it. I think it's more intuitive to use the IDE since a lot of the UI designed using it and that's where most developers go first.- Yeah, there's no way to do that from the IDE other than to manually edit the code. Sorry.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser- Marked As Answer byHerr Blitzkrieg Friday, October 30, 2009 5:09 PM
- Thanks for the quick replies David - much appreciated.


