1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not String.IsNullOrEmpty(strFile) Then
Try
Dim fileToChange As FileStream = New FileStream(strFile, FileMode.Open, FileAccess.Write)
' Write a byte representing "A" onto the end of the file.
fileToChange.Seek(strFile.Length, SeekOrigin.Begin)
fileToChange.WriteByte(DateTime.Now.ToString("ss"))
fileToChange.Close()
Catch ex As IOException
MessageBox.Show("Error opening or writing to file: " & ex.Message)
End Try
Else
MessageBox.Show("Please select a file to check/change first before trying to change it.")
End If
End Sub
|
沒有留言:
張貼留言