View Single Post
  #8 (permalink)  
Old March 8th, 2004, 02:20 PM
meinken meinken is offline
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why won't the following work?

<%@ Page Language="VB" Debug="True" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Diagnostics" %>
<script runat="server">

    Sub Page_Load(sender as Object, e as EventArgs)
        Dim myWatcher As New System.IO.FileSystemWatcher

        Dim myPath As String = "C:\temp"

        myWatcher.Path = myPath

        myWatcher.EnableRaisingEvents = True

        AddHandler myWatcher.Created, AddressOf logchange

        AddHandler myWatcher.Changed, AddressOf logchange

    End Sub

    Public Sub logchange(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
        If e.ChangeType = WatcherChangeTypes.Created Then
            Label1.Text = e.FullPath & " was created"
        ElseIf e.ChangeType = WatcherChangeTypes.Changed Then
            Label1.Text = e.FullPath & " was changed"
        End If

    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <asp:Label id="Label1" runat="server">Watching for changes to c:\temp...</asp:Label>
    </form>
</body>
</html>


Reply With Quote