Background Image

waraq

Member
Joined
Dec 18, 2006
Messages
23
Location
Harrison, TN
Programming Experience
Beginner
Hi!

I'm having problems changing the background image on a command button once the application is installed in a sencond computer. I get the following message every time I mousehover the command button:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.drawing.dll
Additional information: C:\Documents and Settings\Admin\Desk\ACT-SystemTool\ColorA.ico

This is what I did:
Dim Camino AsString = Path.GetFullPath("..\..\ColorA.ico")
btnAR.BackgroundImage = BackgroundImage.FromFile(Camino)

Yes, the folder with the files are in the main distribution application folder.
progress.gif
 
No.What I'm trying to do is this:

Dim Camino AsString = Path.GetFullPath("..\..\ColorA.ico")

I want the App. read the full path of the file when it's installed in any other computer, and then change the Image ColorA.ico to Color6.ico.
For some reason I can't figure it out

btnAR.BackgroundImage = BackgroundImage.FromFile(Camino)

Thanks
Waraq
 
Well, it depends on your development and deployment's directory structure. For my experience in the development area, I will put all the icon in my bin directory, and I will use the Application.StartUpPath & "\" & "icon1.ico" to refer to the icon.

In the deployment machine, I can copy what is the exatly in the bin directory (same structure) to it and it run perfectly.
 
I appreciate your prompt response.
The files are in the main bin folder and I want to read the path to the files so I can change my images on the buttons when the mousehover.
Ok, Every time I install the app. on another computer the directory is different, and the idea is to read the directory path to acces the file and place in the specific string (Camino).
 
Hi! Thank you, it really helped me and the code was very easy to understand.
I see that you use XML file to access the desire directory, I haven't read much about XML, but the only knowlege I have is that ADO.NET and XML go hand in hand. XML is a method of representing structured data.

I created a folder and placed all the files and icons in the folder. The folder is in my main project folder. I haven't made any deployment yet. I've just been copying the project folder onto a disk and then using the disk to install the App. on another computer. I hope this makes a little sense. Since I'm a beginner on VB.NET, I just have VS.NET Standard Edition. This Stadard Edition allows me to release my App. and not deploy it.
 
Back
Top