|
-
Jun 19th, 2010, 02:39 AM
#1
Thread Starter
Lively Member
Reading from embedded resources
hi all,
i have added 3 .png files [done.png, failed.png, busy.png] to my project & changed them to "embedded resource" [from this wht i understand is that they will be integrated within the exe hence eliminating the dependency on the actual location it is stored]
i have 1 picturebox on my form whose image i have to change as per the output of something else
this is wht my code looks like :
Code:
If text1.text = "Done" then
picturebox1.image = my.resources.done.png
end if
If text1.text = "Failed" then
picturebox1.image = my.resources.failed.png
end if
but it gives me error during run time.. am i using the right code ? or is there an alternate method for this ?
-
Jun 19th, 2010, 02:57 AM
#2
Re: Reading from embedded resources
Just leave off the .png. The resource names are built automatically from the file name less the extension, although you can change them to anything you like.
BB
-
Jun 19th, 2010, 03:03 AM
#3
Re: Reading from embedded resources
If you want to use My.Resources then you can't add the files to the Solution Explorer directly. You have to add them to the Resources page of the project properties. You have two choices:
1. Delete your files from the Solution Explorer. Open the project properties to the Resources page. Add your files. Now you can use My.Resources in code.
2. Change your code to use the ResourceManager class to get your resources by name.
I'd go with the first option.
-
Jun 19th, 2010, 03:14 AM
#4
Thread Starter
Lively Member
Re: Reading from embedded resources
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|