G
Guest
Hello!
I posted this problem earlier. I wrote a quick test project, and I still
have the same problem. So I'm sure it's something in my code that I'm not
writing correctly.
Basicly I'm creating a file with abutton click from one application. The
other application has a file watch setup, when it see the newly created file,
it is prompted to open up a new form. But it locks up atn the very end of
opening up the form.
Take a look at my code, what am I doing wrong? Or is there a better way of
doing this? Thanks!
Rudy
SERVER APPLICATION
<BEGIN CODE>
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim TimeStamp As String = Guid.NewGuid.GetHashCode
Dim TempFile As String = "C:\test\watch"
Dim ext As String = ".out"
Dim FileName As String = TempFile & TimeStamp & ext
Dim fs As New FileStream(FileName, FileMode.Create)
fs.Close()
End Sub
End Class
CLIENT APPLICATION with from that has watch process
<BEGIN CODE>
Imports System.IO
Public Class Form2
Inherits System.Windows.Forms.Form
Public NKWatch As New FileSystemWatcher
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AddHandler NKWatch.Created, AddressOf NKWatch_Created
Try
NKWatch.Path = "C:\test\watch"
NKWatch.Filter = "*.out"
NKWatch.IncludeSubdirectories = False
NKWatch.EnableRaisingEvents = True
Catch ERR As Exception
MessageBox.Show(ERR.Message)
End Try
End Sub
Public Sub NKWatch_Created(ByVal sender As Object, ByVal e As
System.IO.FileSystemEventArgs)
Dim frmFirst As New Form1
Me.Hide()
frmFirst.Show()
Application.DoEvents()
End Sub
End Class
I posted this problem earlier. I wrote a quick test project, and I still
have the same problem. So I'm sure it's something in my code that I'm not
writing correctly.
Basicly I'm creating a file with abutton click from one application. The
other application has a file watch setup, when it see the newly created file,
it is prompted to open up a new form. But it locks up atn the very end of
opening up the form.
Take a look at my code, what am I doing wrong? Or is there a better way of
doing this? Thanks!
Rudy
SERVER APPLICATION
<BEGIN CODE>
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim TimeStamp As String = Guid.NewGuid.GetHashCode
Dim TempFile As String = "C:\test\watch"
Dim ext As String = ".out"
Dim FileName As String = TempFile & TimeStamp & ext
Dim fs As New FileStream(FileName, FileMode.Create)
fs.Close()
End Sub
End Class
CLIENT APPLICATION with from that has watch process
<BEGIN CODE>
Imports System.IO
Public Class Form2
Inherits System.Windows.Forms.Form
Public NKWatch As New FileSystemWatcher
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AddHandler NKWatch.Created, AddressOf NKWatch_Created
Try
NKWatch.Path = "C:\test\watch"
NKWatch.Filter = "*.out"
NKWatch.IncludeSubdirectories = False
NKWatch.EnableRaisingEvents = True
Catch ERR As Exception
MessageBox.Show(ERR.Message)
End Try
End Sub
Public Sub NKWatch_Created(ByVal sender As Object, ByVal e As
System.IO.FileSystemEventArgs)
Dim frmFirst As New Form1
Me.Hide()
frmFirst.Show()
Application.DoEvents()
End Sub
End Class