Solved

Excel VB.netC drive access

Posted on 2014-04-08
5
277 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
  • 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 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