How to code image path relative to project
by Dean Slindee » Sat, 12 Aug 2006 02:33:25 GMT
In order to deploy my app, I need to specify the following file path as
relative to my project. I need the image to be a file so that it can be
processed by the "DrawImageToScale" function so that the image is reduced in
size to a panel on the form.
Dim img As Image =
Image.FromFile("C:\Project\HumanServices\HumanServices\image\Contact.jpg")
Call DrawImageToScale(picModule1, img)
If this is not possible, is there a way to convert an embedded Resource
into a File or Stream?
Thanks,
Dean S
RE: How to code image path relative to project
by aXdkdTE1 » Sat, 12 Aug 2006 02:50:01 GMT
is
Image.FromFile(Application.StartupPath & "\Image\contact.jpg")
what your looking for?
--
-iwdu15
Re: How to code image path relative to project
by Mythran » Sat, 12 Aug 2006 03:02:43 GMT
To get the embedded resource as a stream, you use Reflection. Look up the
GetManifestResourceStream method on the Assembly class :)
HTH,
Mythran
Re: How to code image path relative to project
by Herfried K. Wagner [MVP] » Sat, 12 Aug 2006 07:03:27 GMT
"iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
It's better to use 'Path.Combine' to concatenate the path with the file name
to prevent problems arising when the program is installed into the root
directory of the drive which may cause double backslashes to appear in the
combined path.
--
M S Herfried K. Wagner
M V P <URL: http://www.**--****.com/ ;
V B <URL: http://www.**--****.com/ ;
Re: How to code image path relative to project
by Cor Ligthert [MVP] » Sat, 12 Aug 2006 14:07:46 GMT
Herfried,
Thank I will pay attention to that in future
Cor
"Herfried K. Wagner [MVP]" < XXXX@XXXXX.COM > schreef in bericht
Similar Threads:
1.Project Output path converts to Relative path automatically
Hello there,
In the project configuration properties, whenever I change the
Build/Output path to a absolute path and close the window and If I go
there again I see it is automatically changed to a relative path. But I
want my project output to be a specific folder irrespective of where I
keep my solution.
For eg:
if I set the output path to "C:\Program files\MyApp\Bin" and apply it.
But If I go ther again it is changed to something like
"..\..\..\MyApp\Bin".
Does anybody have any idea why this behaviour is and how to change
this???
Btw, I'm using VS.NET 2003 IDE.
2.VB6 Relative paths in the VB project file (.vbp)
Hi All,
I hope I have the right forum for this question?
I am having trouble building an exe from the vbp through our source control
software when relative paths
are used to locate references. For a bit of background I am developing an in
house application in VB6 and we are using Harvest for our source control, our
desktop PC's have recently been migrated to XP while our Harvest server is
still running on a NT Server.
The issue I am encountering is due to references in the vbp using relative
paths instead of absolute. When the vbp
is checked out of source control it contains absolute paths to the reference
files. But after development on an XP machine the project is saved and the
reference paths in the vbp file are changed from absolute to relative. Once
the vbp and associated files are checked back into Harvest a script is run on
the Harvest server to build a new exe.
This is the point where the process fails. Because the vbp contains relative
paths the compiler is searching in the
incorrect directory in Harvest for the referenced files.
I have been able to circumvent the issue by manually updating the vbp file
through a text editor. But I am looking for
a more permanent solution. Is there any way I can switch off (force) VB6 to
use relative paths instead of absolute?
Cheers
3.relative path for const in vba code
Hi All,
i have an excel-project with a separate xml file where config
information is stored. this xml is reference through a public constant
with an absolute path, like that:
Public Const strXMLFile As String = "D:\Documents and
Settings\t119637\Desktop\xls_work\Config\config.xml"
This works as long as the xls file runs on the machine where this
absolute file path is existing.
If i'd like to move these files (the excel file with the vba code and
the xml file) to another machine where this path is not existing, the
excel sheet wont work cause the xml file is not found.
Is there a ways to define a relative path to the xml file startin from
the actual xls file?
E.g:
the excel is stored in:
xls_work/myFile.xls
and the xml file is stored in
xls_work\Config\config.xml
So i would assume that the vba code needs to determine what the path to
the xls file is and add a /Config/config.xml to that path to have the
xls file work with the settings in the xml file.
I dont know the vba code that makes this possible
help woul be greatly apreciated
regards
thomas
4.Dynamically replacing relative path hyperlink with absolute path
I'm using Word 2002 SP3 (10.5522.6714).
We are looking at the possibility of having to change the hyperlinks from
relative to absolute paths in thousands of documents stored in multiple
folders stored on a single drive.
Does anyone know of a way to replace these dynamically with a program?
Currently, the hyperlinks are mostly just a document name since the other
document is in the same folder. I need to be able to grab the complete path
and add it to the file name in the hyperlink.
5.Image URL ....relative path
6. Create Image from relative path
7. Broken relative file paths when debugging file-system type web project in VS 2005
8. Howto: Including Source Code Files from a Relative Path