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