Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

// Create a Bitmap object from a file.

Bitmap myBitmap = new Bitmap("Grapes.jpg");

 

Got that from the MSDN helpfile to load an image.

 

But I get a runtime error about a wrong path. First I only placed the file into the folder and then imported it into the project making it an embedded resource. Still doesn't work.

Debug me...
Posted

Thx that did it.....

 

So how am I gonna load it dynmically. E.g. I let the user choose a picture through the filedialog. I'll have the absolute path then but using the absolute path in my example doesn't work. I could live with copying the file into an images folder of my application but then again it's not in the same directory as the executable.

Debug me...
Posted
...using the absolute path in my example doesn't work.

Why not? It should do.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Posted

Just make sure its in the string ...

 

Bitmap myBitmap = new Bitmap("C:\Grapes.jpg");

 

VB code:

dim path as string

picturebox.image = new Bitmap(path)

 

should work fine.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...