473,322 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to refer a file under its project folder

Hi, I have a question as below:
* myProject\bin\debug\question.bmp // image file
* new Bitmap(@"question.bmp"); // use it
* If I still want use line 2 to use it,
but I want to store the file directly under myProject
Please advise.
Peter
Nov 22 '05 #1
2 1650
> * new Bitmap(@"..\..\question.bmp"); // use it

"..\" will bring you to the parent directory, you can repeat this as many
times as is needed: "..\..\".

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Peter" <an*******@discussions.microsoft.com> schreef in bericht
news:02****************************@phx.gbl...
Hi, I have a question as below:
* myProject\bin\debug\question.bmp // image file
* new Bitmap(@"question.bmp"); // use it
* If I still want use line 2 to use it,
but I want to store the file directly under myProject
Please advise.
Peter

Nov 22 '05 #2
Thanks Jan. Your way is a solution. Later I found another
solution like below:
* add the file in the project
* in its properties window of the file,
set property Build Action to embedded resource
* The exe file size increases. This way is less dynamic.
Thanks again.
Peter
-----Original Message-----
* new Bitmap(@"..\..\question.bmp"); // use it
"..\" will bring you to the parent directory, you can

repeat this as manytimes as is needed: "..\..\".

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Peter" <an*******@discussions.microsoft.com> schreef in berichtnews:02****************************@phx.gbl...
Hi, I have a question as below:
* myProject\bin\debug\question.bmp // image file
* new Bitmap(@"question.bmp"); // use it
* If I still want use line 2 to use it,
but I want to store the file directly under myProject
Please advise.
Peter

.

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
3
by: Dave Y | last post by:
Hello, I am new to ASP as well as IIS. I am trying to learn how to create a web application using asp.NET. I have followed the instructions for configuring the IIS settings but when I click on...
4
by: Rob Tillie | last post by:
Hello, I want an xml file, part of the project, be included in the build so that it gets to debug/bin. I already set the build action "content", which describes what I want, but vs.net doesn't...
2
by: Dan Baker | last post by:
I'm relatively new to the .cs world. I would like to have some "shared" .cs files, which several solutions can use. I don't want to place these in a ..dll, I simply want them included into...
5
by: Dica | last post by:
i've followed the instructions i found here about how to add a config file to my applicaiton: http://www.c-sharpcorner.com/Code/2003/Nov/CreateUseConfigFiles.asp the instructions state that i...
1
by: ad | last post by:
I place a Loading.aspx in the Util folder of my project, Util folder in in the root directory. I refer Loading.aspx in this way: ~/Util/Loading.aspx in Javascript, But it fail to find...
2
by: =?Utf-8?B?SmVmZnJleQ==?= | last post by:
I made a typo on a Project name (e.g. Wong, instead of Wang). Later on I renamed the Soution, Project, WebForm., etc, except the file folder name, back to Wang. Then after I closed the VS.net and...
4
by: Alan Mailer | last post by:
Again, I'm new to VB.net and there is something I need help with: Like (I assume) many of us, over time I want to be able to create some VB.net classes that I might want to use in more than one...
11
by: Web Search Store | last post by:
Hello, I set up a web page with 2 user controls. In classic asp, the first one did all the declarations, and the second one used the values, and could reset it. In ASP.Net so far I can't...
5
by: Web Search Store | last post by:
Hello, I made a web page using visual studio. I also made a public class in the app_code folder called 'allvars' In the main web page durning the page startup, I can refer to public shared...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.