Solved

Excel VB.netC drive access

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

827 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