Malfunction Posted February 5, 2004 Posted February 5, 2004 // 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. Quote Debug me...
Administrators PlausiblyDamp Posted February 5, 2004 Administrators Posted February 5, 2004 Is it in the same folder as the executable? If you are using visual studio the .exe is found in a sub folder of the solution (Debug\bin or Release\bin). Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Malfunction Posted February 6, 2004 Author Posted February 6, 2004 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. Quote Debug me...
TechnoTone Posted February 6, 2004 Posted February 6, 2004 ...using the absolute path in my example doesn't work. Why not? It should do. Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
Illusion Posted February 6, 2004 Posted February 6, 2004 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.