Click here to Skip to main content
15,891,694 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a confusing issue that has occurred with loading an image into the background of a form. My app has been working fine on the computer it was developed in, but when I transferred the app to a new computer with a fresh Windows 8.1 install the picture does not get loaded into the forms background.

Here is the code. Very simple.

Dim sImageFilename As String = Settings.ProjectDirectory & cSubFolderPages & PageArray(Me.Tag).ImageFilename
If System.IO.File.Exists(sImageFilename) = True Then
Me.BackgroundImage = System.Drawing.Image.FromFile(Settings.ProjectDirectory & cSubFolderPages & PageArray(Me.Tag).ImageFilename)
End If
Me.BackgroundImageLayout = ImageLayout.None


I've tested the code loading the file into a PictureBox control and it works fine. But on one computer it wont load the image into the forms background, and the other it will. I get no error messages or other warnings.

Any help appreciated.
Posted
Comments
Frankie-C 8-Feb-15 6:28am    
Have you checked that the path to the image is the same on the other computer.
CoderzF1 8-Feb-15 15:27pm    
are the images stored in the same directory ad the running app? also, what is the point in declaring a variable with the file name if you arent going to use it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900