I've been trying to get the download settings for different browsers, and in my research found some code that watches the file system for changes. Perfect! But I cannot get the filename, its always the directory.
All the help I am reading says that e.name should work, but it again, only returns the directory.
Here is the code I am working with :
I cannot for the life of me figure out how to get the actual file name? Its always the path, minus the filename.
Any help is greatly appreciated. This solved a major problem for me!!
Thanks
Nick
All the help I am reading says that e.name should work, but it again, only returns the directory.
Here is the code I am working with :
VB.NET:
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim watcher As New FileSystemWatcher
watcher.Path = Me.TextBox1.Text
watcher.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName Or NotifyFilters.DirectoryName)
AddHandler watcher.Changed, AddressOf OnChanged
AddHandler watcher.Created, AddressOf OnChanged
AddHandler watcher.Deleted, AddressOf OnChanged
AddHandler watcher.Renamed, AddressOf OnRenamed
watcher.EnableRaisingEvents = True
End Sub
Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
MsgBox("File: " & e.Name & " " & e.ChangeType)
End Sub
Sub OnRenamed(ByVal source As Object, ByVal e As FileSystemEventArgs)
End Sub
End Class
I cannot for the life of me figure out how to get the actual file name? Its always the path, minus the filename.
Any help is greatly appreciated. This solved a major problem for me!!
Thanks
Nick