CattleRustler Posted July 7, 2004 Posted July 7, 2004 (edited) I have a dll that as part of its functionality throws a form up, the form has a picbox that has a bmp as a logo - the problem is that once deployed (the test app using the dll) an error is thrown because the ultimate path to the bmp file is not right. I have experimented with a bunch of ways to point to the dll directory (which is the same as the exe dir) but to no avail. everything works fine in a non-deployed scenario. How can I reference "The bitmap located wherever the dll is located" - from withing the form code within the dll? tis prolly summin silly, eh? EDIT: In other words, whats a dll's equivalent of a forms "Application.StartupPath" property? Edited July 7, 2004 by CattleRustler Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
sjn78 Posted July 7, 2004 Posted July 7, 2004 Where is the picture? Can you just use a path like "\images\yourpicture.jpg" which would be "location of your dll\images\yourpicture.jpg" Quote
Administrators PlausiblyDamp Posted July 7, 2004 Administrators Posted July 7, 2004 Could you not include the .bmp as an embedded resource in the DLL? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
CattleRustler Posted July 7, 2004 Author Posted July 7, 2004 Plausibly- that sounds like the way. I haven't done that before. How do I do that? <snoops around in vs.net, and eagerly awaits a reply> Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
CattleRustler Posted July 7, 2004 Author Posted July 7, 2004 scratch that- I added the file as an embedded resource but am still trying to tell my form_load where to find it.... I will keep trying. any insight welcome, thanks! Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
CattleRustler Posted July 7, 2004 Author Posted July 7, 2004 No good - cant get it working.... HELP :( Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
Administrators PlausiblyDamp Posted July 8, 2004 Administrators Posted July 8, 2004 (edited) You should be able to use code similar to that posted in this thread within the dll to access the resource. Edited July 8, 2004 by PlausiblyDamp Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
CattleRustler Posted July 8, 2004 Author Posted July 8, 2004 PlausiblyDamp, SPOT ON Brother! Sweet! Thanks a ton :) James Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
CattleRustler Posted July 9, 2004 Author Posted July 9, 2004 @PlausiblyDamp Turns out I am a dummy :) from my main dll code I can reference the Application.StartUpPath & "\myimage", and then set the form's PicBox.Image property prior to showing the form. Since the image file has to be distributed even when its set as an embedded resource in the project, I changed the code to use whats above. The compiled dll ends up being smaller, and I save a few lines of code. Thanks anyway tho - I saved that project (the one that link points to) as a reference that I am sure will come in handy. Thanks again James Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
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.