Reply to thread

Hi All,


How to show all activity in textbox1 in Sub OnChanged.


Imports System.IO


Public Class Form1

    Dim fsw As New FileSystemWatcher("C:\")


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        AddHandler fsw.Created, AddressOf OnChanged


        With fsw

            .EnableRaisingEvents = True

            .IncludeSubdirectories = True

            '

            ' Specif the event to watch for.

            '

            .WaitForChanged(WatcherChangeTypes.Created)

            '

            ' Specify file change notifications.

            '

            .NotifyFilter = (NotifyFilters.LastAccess Or

                             NotifyFilters.LastWrite Or

                             NotifyFilters.FileName Or

                             NotifyFilters.DirectoryName)

        End With

    End Sub

    Public Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)


        If e.ChangeType = IO.WatcherChangeTypes.Created Then

            TextBox1.Text += e.FullPath.ToString & vbCrLf

        End If



    End Sub



End Class




thank.


Continue reading...


Back
Top