Solved

Full Path of Given Folder

Posted on 2012-03-28
8
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

635 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