Reputation:
I am designing an app and I want to attach some pictures to my VB forms. I have used a picture box and the image is only visible before I debug. Once debugging starts, the image disappears.
How do I display the image when I run the debugger? This is the code I used for the picture box:
PictureBox1.Image = My.Resources.tropical_island3
Upvotes: 1
Views: 5988
Reputation: 434
I ran into a similar problem on a VB.NET form. I found when loading the form as a modal window (.ShowDialog
) the image in the picture box showed fine, but if loading the form as non-modal (.Show
) the PictureBox
showed with a white background.
To resolve showing the image in the non-modal form, I needed to call .Refresh
for the form after the .Show
Hope that helps someone else!
Upvotes: 2
Reputation: 15813
This is a possibility, based on the limited info:
If the image is shown in the picturebox before you run the form in debug mode, then it apparently has been assigned at design time to the PictureBox1.Image property. When you run the program and assign My.Resources.tropical_island3 to the Picture Box image, it clears the image because My.Resources on your home computer does not have tropical_island3 like the one at class, or maybe tropical_island3 is spelled incorrectly.
Upvotes: 0