For example, you can do this:
Try
File.AppendAllText("C:\Windows\Demo.txt", DateTime.Now.ToString() & Environment.NewLine)
Catch exc As IOException When exc.HResult = &H80070020
' ignore
End Try
Make sure that you have rights to write to Windows directory.