473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Using the resource folder

I have an image which I need to load

PictureBox1.Image = Image.FromFile(My.Resources.myimage)

and this worked fine when the image (myimage.jpg) was in the debug Bin
directory. I now am moving them all to
a folder called Resources and specify the files as above. Doesn't work
though and the file is definitely there and VB.Net recognizes it when
I type in the expression. What's wrong? it's looking for a string.
Thanks

K.
Jul 16 '08 #1
2 8561
On Jul 17, 2:09 am, kronec...@yahoo.co.uk wrote:
I have an image which I need to load

PictureBox1.Image = Image.FromFile(My.Resources.myimage)

and this worked fine when the image (myimage.jpg) was in the debug Bin
directory. I now am moving them all to
a folder called Resources and specify the files as above. Doesn't work
though and the file is definitely there and VB.Net recognizes it when
I type in the expression. What's wrong? it's looking for a string.

Thanks

K.
Hi,
Maybe you linked the image instead of embedding, see your
application's Properties -Resources, then click on your image, then
check the option called "persistence", maybe you can change it
"embedded in .resx" if it was set to "linked at compile time" by
default.

And maybe that may be helpful:
http://visualbasic.about.com/od/usin...a/ResVBNET.htm

Hope this helps,

Onur Güzel
Jul 17 '08 #2
Please never post about an error without telling us the error message.

Image.FromFile loads a file from a file name so my guess is that you perhaps
thought you used image file resources (?) when your resources are actually
just the file names.

It worked as long as the exe file and the image files were in the same
directory but stopped working then...

You could :
- either keep this and specify the directory from which image files should
be loaded
- truly add images as resources in which case you'll have just to do
PictureBox1.Image=My.Resources.ResourceFile.MyImag e...

--
Patrice

<kr*******@yahoo.co.uka écrit dans le message de groupe de discussion :
e5**********************************...oglegroups.com...
I have an image which I need to load

PictureBox1.Image = Image.FromFile(My.Resources.myimage)

and this worked fine when the image (myimage.jpg) was in the debug Bin
directory. I now am moving them all to
a folder called Resources and specify the files as above. Doesn't work
though and the file is definitely there and VB.Net recognizes it when
I type in the expression. What's wrong? it's looking for a string.
Thanks

K.

Jul 17 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: bj7lewis | last post by:
I am working on a project I want to add a few files as resource to access(copy them to FS and use) at runtime. So far in VS.NET IDE, I Add Files to the project and set its Build Action to...
1
by: Kaworu | last post by:
Hi, at first time I want to apologize for my English. I need to change the language of my app and I like to do it changin the caption of the controls in the resource.rc file, or having on...
0
by: Ray | last post by:
Hi all, While I am using resource files to change the language of the form, the form cannot update the language of the text of the label by itself. I only know to do that using the following code:...
2
by: poojo hackma | last post by:
In my Project, I have added a couple hundred images using "drag-n-drop" to the Properties.Resources section. All of these images were in the "images" folder of my Project on my computer, and the...
0
by: vivek | last post by:
localization of lang. using resource files resides in the global resources folder (App_GlobalResources). Currently In my application, I need to have different language resource files in global...
0
by: amitmnagarwal | last post by:
Hi all, This is regarding the using resource files to read the data. I have a common function where the code for reading the data exists. The common method has the following code: Dim...
1
by: Bill Mell | last post by:
I would like to use compiled resource files in my web application that are not related to localization. The idea is to have a dll with resources that can be accessed by the website. I have no...
1
by: CRSiva | last post by:
Hello everybody. I have an application in English language and I want to add it a new language, German, for example. I tried to use 'Using Resource DLLs' feature. Everything was OK until I tried...
1
by: Christian | last post by:
Hi, i added an image in my Solution in folder Resources and now i will open... Someone can help me? thanks
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.