Re: Filewatch saga continues



But if everything else is working fine then the only thing left is the form
right?

I just cut and pasted the code and had it out "file created" to the
immediate window and it works. So try not hiding "me" and see if the form
isn't sitting there waiting for you to do something. The
Application.DoEvents() isn't doing anything as far as I can tell either.
I'm still quite certain your program is running you just can't see the form
because you've hidden it. frmFirst doesn't have focus and it's destroyed
immediately.



"Rudy" <Rudy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B4C18D95-2798-43EC-B2CB-C65CA390EBB1@xxxxxxxxxxxxxxxx
Hi Tom!

Thnks for the suggestions. I did make sure my watch works properly, but
having a s simple message box displayed. So I'm good there. I did try and
create a click event on the client ap, and open up the second form, and
that
works fine. Iknow the form is locked up, because after a few seconds, I
get
a non-responding on the window on my form. When I try to debug it, it
doesnt
stop anywhere. Even when I put breka points, at the form load of the form
2,
form 1 and the file wacther. And to make things more intersting, after I
get
the window that ask if I want to stop this program, do you want to send it
Microsoft. I get a meesage form CS 2003 that says "There is no source code
avaiable for the current location"

So I'm not sure sure where to look. I wrote this simple app, eleminating
everything elses in my real program. I hope if I can get this to work, I
might be able to fix my real application.

Any other thoughts?

Thanks!
Rudy

"Tom Leylan" wrote:

There are a couple of suggestions I would like to offer. The first is
(when
you're testing things that don't work) is to eliminate the parts that
don't
(or probably don't) impact the problem. You could for instance still see
the problem even if you eliminate the "server app" from the equation.
You
can simply copy a file into the folder and that will work as well. The
reason is that you're trying to narrow things down, the more pieces
involved
the harder that will be.

And don't create and show a form when you're not certain the watcher is
working. Again you can output a simple message "I see it" to an output
window and reduce the number of suspicious spots even more.

The next suggestion is to use the debugger. What is your client
application
doing when you think it has locked up? What do you want it to do? If
I'm
not mistaken you'll find that your client app is running but without a
form
on display. You are hiding the main form and showing a "Form1" (you
should
rename that class) but it won't retain the focus the way you've written
it.
It closes, the event handler is exited and frmFirst goes out of scope and
is
destroyed.

I don't believe it has locked up I believe you can't see that it is still
running.

Tom


"Rudy" <Rudy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CCFE8EAD-37D7-4E2F-B7C9-B29D593670E2@xxxxxxxxxxxxxxxx
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





.



Relevant Pages

  • Re: Input box based upon a list
    ... Private Sub UserForm_Initialize ... Dim sourcedoc As Word.Document ... ' Open the file containing the client details ... ' Get the number of columns in the table of client details ...
    (microsoft.public.word.vba.userforms)
  • RE: Nested Datagrid spanning columns of Parent Datagrid
    ... (basically all the code that you have enclosing the Public Class ... Private Sub Page_Init(ByVal sender As System.Object, ... Protected ChildGrid As MIMSearch.ChildDataGrid ... Dim dt As DataTable ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Need to pull Combo Box Info and Populate Fields from Access (or SQ
    ... Private Sub UserForm_Initialize ... Dim rs As DAO.Recordset ... ' Open the file containing the client details ...
    (microsoft.public.word.vba.general)
  • Re: Filewatch saga continues
    ... What is your client ... Public Class Form1 ... Private Sub Button1_Click(ByVal sender As System.Object, ... Dim TimeStamp As String = Guid.NewGuid.GetHashCode ...
    (microsoft.public.dotnet.general)
  • Re: Filewatch saga continues
    ... What is your client ... Public Class Form1 ... Private Sub Button1_Click(ByVal sender As System.Object, ... Dim TimeStamp As String = Guid.NewGuid.GetHashCode ...
    (microsoft.public.dotnet.general)