Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Full Path of Given Folder

Posted on 2012-03-28
8
Medium Priority
?
404 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 668 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 668 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37775960
0
 
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 75

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 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 664 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

782 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