[.NET] vb2008 新手在MSDN學 遇到困難
windows form
我要利用filesystemwatcher來監控一個資料夾
要是多出一個檔案,就印出檔案的真實路徑
到msdn網頁蠻多教學
可是其實我看不懂
他提供那些程式碼,我根本不知道怎麼使用
http://msdn.microsoft.com/zh-tw/library/28y7bbdc(VS.80).aspx
我有好多疑問,它上面的程式碼複製下來,標籤 都用一用,還是不能跑
"錯誤 1 Handles 子句需要 WithEvents 變數,該變數定義於包含型別或它的一種基底型
別中。"
有出現這個錯誤,或是我自己打
Public Class Form1
Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object,
ByVal e As System.IO.FileSystemEventArgs)Handles FileSystemWatcher1.Changed
Dim kai As New System.IO.FileSystemWatcher()
kai.NotifyFilter = System.IO.NotifyFilters.FileName
Me.Label1.Text = "Changes made to: " '& e.FullPath
kai.Path = "D:\test"
.
kai.Filter = "*.txt"
kai.IncludeSubdirectories = False
kai.NotifyFilter = System.IO.NotifyFilters.LastWrite
kai.NotifyFilter = _
System.IO.NotifyFilters.LastAccess Or System.IO.NotifyFilters.Size
kai.EnableRaisingEvents = True
End Sub
End Class
雖然沒出錯,但是我更改文字檔也沒有動作
其實我是不知道如何把網站的範例,拿下來用
拜託各位神手教教我@@"
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.224.91.76
討論串 (同標題文章)