Answered How to make file readonly programatically?

capedech

Well-known member
Joined
Oct 29, 2008
Messages
62
Programming Experience
Beginner
Hi,
I am making a program to save it to (.txt).
I am making it using System.IO.
So far, my program can save the file already.
But, I don't know how to make it readonly programatically.
Please help me.

Thanks in Advance.

Regards,
 
Last edited:
Along the lines of what MattP's already posted, I would simply use a FileInfo object:
VB.NET:
Dim CurrFile As New FileInfo(FileName)
CurrFile.Attributes = CurrFile.Attributes Or FileAttributes.ReadOnly
 

Latest posts

Back
Top