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:

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
Along the lines of what MattP's already posted, I would simply use a FileInfo object:
Code:
Dim CurrFile As New FileInfo(FileName)
CurrFile.Attributes = CurrFile.Attributes Or FileAttributes.ReadOnly
 
Top Bottom