0

i am using this code for set a logo.. its work in my system. when i build it it doesn't work in another system.

Dim imag As Image = Image.FromFile("C:\Users\sijiya\Documents\Visual Studio 2010\Projects\NimasApplication\NimasApplication\Images\limas11.png")

e.Graphics.DrawImage(imag, 250, 3, 200, 95)

Sijiya
  • 1
  • 1
  • 3

2 Answers2

0

Change the parameter of this one with the path of the new computer:

  Dim imag As Image = Image.FromFile("NewPath\NewFileName here")

But it much better if you use FileDialog to get the file and the path name so it will work on different systems.

Or put it as part of the folder of your project.

Edper
  • 9,144
  • 1
  • 27
  • 46
0

If you have to deploy the project on another PC, you'll have to include the image (logo) in your project Resource. If you're keeping it locally on your PC, it's normal that other PC won't be able to access it.

To call it from your resource directory, try;

Dim imag As Image = CType(My.Resources.ResourceManager.GetObject(ImageName), Image)
Nadeem_MK
  • 7,533
  • 7
  • 50
  • 61
  • Yeah, but you've got to add it to your resource first. Follow [link](http://stackoverflow.com/questions/13304892/add-image-file-resource-to-another-project) or on [MSDN](http://social.msdn.microsoft.com/Forums/vstudio/en-US/969b32ee-e055-4569-bc76-7a19e7daf3c7/add-resources-to-vbnet-programmatically?forum=vbgeneral) – Nadeem_MK Nov 14 '13 at 05:45