resource files (image)

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
i cant see what is wrong with this

VB.NET:
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            PictureBox2.Image = New Bitmap(Me.GetType(), "x.png")
        End Sub

x is in my resources folder, i changed x build action to embedded resource.

says cannot be found when i try using the button

Resource 'x.png' cannot be found in class 'Http.Brycestrosoft.ImageShackAPIWrapperClient.ClientForm'.
 
See this is interesting, i found that line and tryed it before.

error

resource is not a member of my

any ideas?
 
Works fine for me, resource is not a member, but Resources is!
VB.NET:
PictureBox1.Image = My.Resources.GrrZap
 
I just tryed my top line of code in a new application and it worked fine.

why wouldnt it be working in my other one? all set exactly the same :/


Resource 'Delete161.png' cannot be found in class 'Http.Brycestrosoft.ImageShackAPIWrapperClient.ClientForm'.
 
Last edited:
You can add application resources from the Resources window in project properties pages, and they are added to the strongly typed resources proxy where you can access them in code with the My.Resources object. These resources are added to the special Resources folder and has build action set to None.
My.Resources Object
 
But this is what i'm saying. On my application no 'Resource pops up'

i have worked with resources before with no hassel.

Here is a new project like it should, and bottom one is my one im working on

44095065.jpg
 
Back
Top