Link to home
Start Free TrialLog in
Avatar of JeffvClayton
JeffvClayton

asked on

Read Write

I have an Access MDB file on a install disc which my install program copies to the users computer. Trouble is after its copied it ends up as Read only. What is the code for changing it to Read/Write
Avatar of bmatumbura
bmatumbura

You can include a batch file that will also be installed by the installer which removes the read-only attribute when it is executed. The installer should run this batch file after copying the database. The contents of the batch file follow:
@ECHO off
attrib -r -h -s *.mdb

Open in new window

Avatar of Dirk Haest
To remove an attribute use System.IO.File.SetAttributes. Ex:

if(File.GetAttributes(savedCardFilePath) == FileAttributes.ReadOnly)
File.SetAttributes(savedCardFilePath, FileAttributes.Normal);
Avatar of JeffvClayton

ASKER

DHaest,

can you translate the above code to VB.Net?
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I alread tries that but GetAttributes is not a property of System.IO.FileInfo
Sorry I already used the word File as a System.IO.FileInfo variable
 If IO.File.GetAttributes(MyFile) = IO.FileAttributes.ReadOnly Then
             IO.File.SetAttributes(MyFile, IO.FileAttributes.Normal)
   End If