Solved

Full Path of Given Folder

Posted on 2012-03-28
8
373 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML - Color not displaying correctly in EMAIL. 6 49
MVC DDL Json Not Binding to Model 2 26
How to limit User Input 2 27
VS 2017 18 35
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

808 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