Solved

Full Path of Given Folder

Posted on 2012-03-28
8
357 Views
Last Modified: 2012-08-13
Hi

I have a folder that's in my project structure (windows form-based application project)

How do I get it's full path with code?

Please check attached illustration
folder.png
0
Comment
Question by:alfardan
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 5

Assisted Solution

by:Ronak Patel
Ronak Patel earned 167 total points
ID: 37775536
Dim directory as String = My.Application.Info.DirectoryPath

OR

Dim fullPath as String = Path.GetFullPath(Application.ExecutablePath)

Open in new window

0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 167 total points
ID: 37775541
Dim iconsFolder As String
iconsFolder = Path.Combine(Directly.GetCurrentDirectory(), "icons");

Open in new window


Refer here for more details:-
http://stackoverflow.com/questions/2996246/how-do-i-get-path-of-the-directory-inside-my-winform-app-project
0
 

Author Comment

by:alfardan
ID: 37775940
All suggested codes give me the execution folder of the application

The icons folder is not there when I'm running the application in debug mode
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37775960
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 16

Expert Comment

by:Rose Babu
ID: 37776085
Dim iconsPath As String = ""
' if Build output path is bin\Debug\
iconsPath = Application.StartupPath.Replace("\bin\Debug", "\icons")

' if Build output path is bin\Release\
iconsPath = Application.StartupPath.Replace("\bin\Release", "\icons")

Open in new window

Try this.

FYI,

when you publish your application as an exe or creating a setup file, you will add the bin\Debug\ or bin\Release\ folder's files alone.
in this case if you access the folder outside bin\Debug\ or bin\Release\ folder will not work.

so better, create the icons folder in bin\Debug\ or bin\Release\ folder and access that using
Dim iconsPath As String = ""
iconsPath = Application.StartupPath & "\icons"

Open in new window

0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 37776217
The icons folder is not there when I'm running the application in debug mode
I would think that you would want this available to the end application when you build the project, so (within that folder) have you set the files' "Copy to Output" as "Copy Always" (or "Copy if Newer")? If you make the files part of the output, then the above solutions would work fine.
0
 

Author Comment

by:alfardan
ID: 37780115
kaufmed

How do I do this "Copy Always" to the folder "icons"?
0
 
LVL 74

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 166 total points
ID: 37780141
You simply need to do it to the pertinent files under the folder--the folder will be created in the output directory if there are any child files which have been marked as mentioned above.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now