Solved

Excel VB.netC drive access

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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 …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now