Y
yogesh
hello
I getting problem in FileSystemWatcher , I had wrriten the code for
the FileSystemWatcher , when i dropping the new file in the directory
, the WatcherEdi_Created event get fired , but some time it not get
fired. also this happens with muliple files dropping in same folder .
the count of events not equal to number of files droped.Follwing i
scode snippet. please do the needfull for me.
thank in advance.
Yogesh
Private Sub WatcherEdi_Created(ByVal sender As Object, ByVal e As
System.IO.FileSystemEventArgs) Handles WatcherEdi.Created
Dim fileObj As IO.File
Dim FileAccessed As Boolean
Dim strGuid As String
Try
While Not FileAccessed
strISACtrlNum = ""
Try
' Check for 850 file
If get850(e.FullPath) Then
Call getSenderId(e.FullPath)
Call getInterChangeControlNum(e.FullPath)
fileObj.Move(e.FullPath, renamedEdiFilePathEdi
& "Edi " & strISACtrlNum & ".edi")
FileAccessed = True
fileObj = Nothing
Count = Count + 1
Else
If get997(e.FullPath) Then
If getInvoice(e.FullPath) = True Then
'
MsgBox(getInvoicenumber(e.FullPath))
'UpdateInvoiceAck(getInvoicenumber(e.FullPath))
End If
End If
strGuid = (System.Guid.NewGuid.ToString)
fileObj.Move(e.FullPath, OtherEdifilePath &
"\" & strGuid)
FileAccessed = True
fileObj = Nothing
End If
Catch ex As System.IO.IOException
FileAccessed = True
fileObj = Nothing
Exit Try
End Try
End While
Catch ex As Exception
Dim funname = "WacherEDI"
Trace.WriteLine(ex.Message + "Reported In Function: " +
funname + " at: " + DateTime.Now.ToString)
Trace.Flush()
Finally
End Try
End Sub
I getting problem in FileSystemWatcher , I had wrriten the code for
the FileSystemWatcher , when i dropping the new file in the directory
, the WatcherEdi_Created event get fired , but some time it not get
fired. also this happens with muliple files dropping in same folder .
the count of events not equal to number of files droped.Follwing i
scode snippet. please do the needfull for me.
thank in advance.
Yogesh
Private Sub WatcherEdi_Created(ByVal sender As Object, ByVal e As
System.IO.FileSystemEventArgs) Handles WatcherEdi.Created
Dim fileObj As IO.File
Dim FileAccessed As Boolean
Dim strGuid As String
Try
While Not FileAccessed
strISACtrlNum = ""
Try
' Check for 850 file
If get850(e.FullPath) Then
Call getSenderId(e.FullPath)
Call getInterChangeControlNum(e.FullPath)
fileObj.Move(e.FullPath, renamedEdiFilePathEdi
& "Edi " & strISACtrlNum & ".edi")
FileAccessed = True
fileObj = Nothing
Count = Count + 1
Else
If get997(e.FullPath) Then
If getInvoice(e.FullPath) = True Then
'
MsgBox(getInvoicenumber(e.FullPath))
'UpdateInvoiceAck(getInvoicenumber(e.FullPath))
End If
End If
strGuid = (System.Guid.NewGuid.ToString)
fileObj.Move(e.FullPath, OtherEdifilePath &
"\" & strGuid)
FileAccessed = True
fileObj = Nothing
End If
Catch ex As System.IO.IOException
FileAccessed = True
fileObj = Nothing
Exit Try
End Try
End While
Catch ex As Exception
Dim funname = "WacherEDI"
Trace.WriteLine(ex.Message + "Reported In Function: " +
funname + " at: " + DateTime.Now.ToString)
Trace.Flush()
Finally
End Try
End Sub