|
-
Dec 13th, 2012, 12:25 PM
#1
Thread Starter
Addicted Member
Resources problem. Has no property named...
Hy,
I have a problem with a project. I have many forms with different pictureboxex in them. It worked all fine until today. I didn't make any changes and all the pictures won't show up. I even had a backup that worked and now it doesn't work either.
However, other app that was ok has no problem.
So for absolutely every picture, image, backgroundimage, etc... in my project I get: the type projectName.my.resources.resources has no property named 'picturename'
Then I enter the error code and I have:
Me.PictureBox1.BackgroundImage = Global.Project_Manager.My.Resources.Resources.adaugapersoane, where project_manager is the name of my app.
I tried changing this with no luck to:
Me.PictureBox1.BackgroundImage = Global.Project_Manager.My.Resources.adaugapersoane
Me.PictureBox1.BackgroundImage = My.Resources.adaugapersoane
Now, if I run my program the picture is showing up. It also shows up ion the resources area. What's going on?
Has anyone come across this?
What should I do because I can't continue anymore?
I tried deleting the exe file and it works but only for the first compling and then... error...
PLEASE HELP
-
Dec 13th, 2012, 12:37 PM
#2
Re: Resources problem. Has no property named...
Hmmm. Why do I always get suspicious when people say, "I didn't change anything but ..."?
From your rather vague description it sounds like you're using a variable 'picturename' as though it were the name of the resource but with no example of the exact code which causes the error it's next to impossible to make any informed comment.
Are you moving the .exe file at all? Are you building as Debug or Release (or Publish)?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Dec 13th, 2012, 12:45 PM
#3
Re: Resources problem. Has no property named...
If your images are stored as resources you can use the following to query their names
Code:
Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Dim MyProperties As System.Reflection.PropertyInfo() =
GetType(My.Resources.Resources).GetProperties(System.Reflection.BindingFlags.NonPublic Or
System.Reflection.BindingFlags.Instance Or
System.Reflection.BindingFlags.Static)
Dim BitMaps = (From T In MyProperties Where T.PropertyType Is GetType(Bitmap)).ToList
For Each bm In BitMaps
Console.WriteLine(bm.Name)
Next
End Sub
-
Dec 13th, 2012, 12:51 PM
#4
Thread Starter
Addicted Member
Re: Resources problem. Has no property named...
Well I found some articles on the web and it seems there might be a bug in VB2010. I decided to delete all my resources from everywhere and redo them all. I will also rename every resource so I don't have any conflicts at all...
-
Dec 13th, 2012, 12:57 PM
#5
Thread Starter
Addicted Member
Re: Resources problem. Has no property named...
Ok I cleaned all my resources. I added a picture with the name changed. I make it the background image of my picturebox and everything is ok. I exit VB, come again - error:
The type 'Project_Manager.My.Resources.Resources' has no property named 'adangajat'
Then:
Me.PictureBox1.BackgroundImage = Global.Project_Manager.My.Resources.Resources.adangajat
this is the line reported as error
-
Dec 13th, 2012, 01:01 PM
#6
Thread Starter
Addicted Member
Re: Resources problem. Has no property named...
I also tried kevininstructor's code and all the reported names were ok.
-
Dec 13th, 2012, 01:13 PM
#7
Re: Resources problem. Has no property named...
What if you change this
Me.PictureBox1.BackgroundImage = Global.Project_Manager.My.Resources.Resources.adangajat
to
Me.PictureBox1.BackgroundImage = My.Resources.adangajat
assuming that adangajat is the image.
-
Dec 13th, 2012, 01:35 PM
#8
Thread Starter
Addicted Member
Re: Resources problem. Has no property named...
Same error. I can't figure out what happened. I cleaned everything and now I am loading the backgroundimages at runtime, using almost the same code. This works.
Loading them at design time gives me that error.
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
|