How to modify this code to make my StreamWriter file READ ONLY

piscis

Well-known member
Joined
Jun 30, 2003
Messages
54
Does anyone have a clue as to how to modify the code below so the file is saved to the Hard Disk with the
 
Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sReader As New StreamWriter(New FileStream("C:\somestuff.txt", FileMode.OpenOrCreate, FileAccess.Write))
        With sReader
            .WriteLine("some stuff!")
            .Close()
            File.SetAttributes("C:\somestuff.txt", FileAttributes.ReadOnly)
        End With
    End Sub
 
Back
Top