Solved

Excel VB.netC drive access

Posted on 2014-04-08
5
281 Views
Last Modified: 2014-04-10
Hi

I tried to create a directory in the C drive on  client's machine
but access was denied. Is there a way to allow access or should I rather
use the Documents folder?

            If System.IO.Directory.Exists("c:\Program Files\KISS_Accounting") = False Then
                System.IO.Directory.CreateDirectory("c:\Program Files\KISS_Accounting")
            End If
            Dim FILE_NAME As String = "c:\Program Files\KISS_Accounting\Invoice_Number.txt"
0
Comment
Question by:murbro
[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
5 Comments
 
LVL 35

Assisted Solution

by:Kimputer
Kimputer earned 250 total points
ID: 39985792
In a normal user environment, the user has NO access to this folder (creating or modifying), while admins do (but with UAC prompt).
Therefore My Documents would be a better place to put files like that.
0
 

Author Comment

by:murbro
ID: 39985978
Thanks very much
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
ID: 39987773
It depends on the type of file.

As is it going now, because most programmers do not know how to work in Windows, and My Documents has become a dump. My means documents that I created, not documents that are use internally by an application.

If the document is not recorded through a Save or Save As, it has no place in My Documents. The proper location for application files is in a C:\Users\<UserName>\AppData\<CompanyName>\<ApplicationName>

Since C:\Users\<UserName>\AppData can change depending on the operating system version and language, as well as for each user, you can retrieve it with the following call:

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
0
 

Author Closing Comment

by:murbro
ID: 39991385
Thanks very much
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
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 …

724 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