On my build I get the error that it could not find sub main.
I was using an online example to get my code this far.: Business logic removed
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.Text.RegularExpressions
Imports System.Configuration
Imports System.Collections.Specialized.NameValueCollection
Public Class fileWatchService : Inherits System.ServiceProcess.ServiceBase
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Me.FileWatcher.EnableRaisingEvents = True 'THIS is what turns ON the FILEWATCHER
Me.FileWatcher.Filter = "*.pdf"
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
Me.FileWatcher.EnableRaisingEvents = False 'THIS is what turns OFF the FILEWATCHER
End Sub
Private Sub FileWatcher_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileWatcher.Changed
Try
Dim _sDir As String = ConfigurationSettings.AppSettings("WatchDirectory") ' currently C:\TEMP ,needs to be \\Dc1\EFiles in app.conf
Dim _dDir As New DirectoryInfo(_sDir)...
...rest of Business logic removed.
connection.Close()
Catch ex As Exception
End Try
End Sub
End Class
I was using an online example to get my code this far.: Business logic removed
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.Text.RegularExpressions
Imports System.Configuration
Imports System.Collections.Specialized.NameValueCollection
Public Class fileWatchService : Inherits System.ServiceProcess.ServiceBase
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Me.FileWatcher.EnableRaisingEvents = True 'THIS is what turns ON the FILEWATCHER
Me.FileWatcher.Filter = "*.pdf"
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
Me.FileWatcher.EnableRaisingEvents = False 'THIS is what turns OFF the FILEWATCHER
End Sub
Private Sub FileWatcher_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileWatcher.Changed
Try
Dim _sDir As String = ConfigurationSettings.AppSettings("WatchDirectory") ' currently C:\TEMP ,needs to be \\Dc1\EFiles in app.conf
Dim _dDir As New DirectoryInfo(_sDir)...
...rest of Business logic removed.
connection.Close()
Catch ex As Exception
End Try
End Sub
End Class