Results 1 to 8 of 8

Thread: Resources problem. Has no property named...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2012
    Posts
    221

    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

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    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!

  3. #3
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    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

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2012
    Posts
    221

    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...

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2012
    Posts
    221

    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

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2012
    Posts
    221

    Re: Resources problem. Has no property named...

    I also tried kevininstructor's code and all the reported names were ok.

  7. #7
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    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.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2012
    Posts
    221

    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
  •  



Click Here to Expand Forum to Full Width