Quote Originally Posted by jasonli
Declare global variable as a flag. In timer event handler, check the flag to decide run or stop.

I think I tried that. I belive fileFound is a global variable, but thing is in this function
Code:
        
private void call_searchFile()
        {
            richTextBox1.AppendText("Calling to search_file()");
            search_File();

            if(fileFound== true)
                richTextBox1.AppendText("\nFinish search file, do next task");
        }

my second if-statement never gets executed because it doesn't wait for the search_File() to finish its task so it just come straight down to that if-statement while fileFound is false.