Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and exploring the core foundations for app libraries.
Private Sub IntializeFileSystemWatcher()
'Create File System Watcher for DAT files
fsWatcher = New System.IO.FileSystemWatcher("C:\Sample Files", "*.DAT")
' Add event handlers for new files and change of existing files.
'fsWatcher.Changed += new FileSystemEventHandler(OnFileChanged)
AddHandler fsWatcher.Created, AddressOf OnFileCreated
' Begin watching.
fsWatcher.EnableRaisingEvents = True
End Sub
Private Sub OnFileCreated(ByVal source As Object, ByVal e As FileSystemEventArgs)
Dim ConvertXml As Translator
ConvertXml = New Translator()
Dim XmlDoc As New XmlDocument
Try
XmlDoc = ConvertXml.Prepare(e.FullPath.ToString())
XmlDoc.Save("c:\\dynamicsample.xml")
System.Windows.Forms.MessageBox.Show(e.FullPath.ToString(), "", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification)
File.Delete(e.FullPath.ToString())
' MessageBox.Show("XML successful")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message.ToString(), "", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification)
End Try
End Sub
Protected Overrides Sub OnStart(ByVal args() As String)
IntializeFileSystemWatcher()
End Sub
Do more with
Premium Content
You need an Expert Office subscription to comment.Start Free Trial