Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetAttributes to a Word File

Status
Not open for further replies.

Viruland

Programmer
Dec 6, 2000
61
BE
I want to set a Wordfile as ReadOnly at a certain time. I do this with the following code.

Dim aFile as string = "C:\FileName.doc"

File.SetAttributes(aFile, FileAttributes.ReadOnly) = FileAttributes.ReadOnly

The file is ReadOnly but it isn't visible anymore in my Directory. When I set the ReadOnly property to False, using VB.net Code, the file becomes visible.

Can someone tell me what's going on here.

Live fast, die young and leave a beautiful corpse behind.
 
Will it still be visible when the readonly property is set through explorer?
 
Yes, it is still visible.

Live fast, die young and leave a beautiful corpse behind.
 
That was strange.
Try this:
Code:
File.SetAttributes(aFile, FileAttributes.ReadOnly)
as it works for me.

Regards,
mansii
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top