Let me see if I understand what you want. Your code's one big chunk, so I could've missed what's going on.

It looks like you want to search two different files for some data. The data may be in either file, and you aren't really sure which one it is. As soon as the data is found in either file, you want to do some things and stop searching?

At a high level, that is not hard. Starting two asynchronous tasks with cancellation has several patterns. But the way your code is currently structured, it needs a lot of work to get there. You update a lot of controls in response to this data, and that's dangerous when multiple threads are involved.

So I would restructure it as an asynchronous function that returns some data, then update the UI based on that data. That way you can make the searching, which is probably the part that takes a long time, happen asynchronously and do the relatively quick updates on the UI thread in response. The newer task-based APIs would be super convenient for this, but aren't quite as well-supported in VS 2010. You should consider upgrading to VS 2013 (my favorite) or VS 2015, unless you have a strong technical reason to use VS 2010.

Now, if you really want both to run at the same time, just be allowed to finish at different times, you still need to do the same thing. Other threads cannot update the UI, and things would get messy if they could. If you make the changes discussed above, you won't have that problem.

So let's make sure we understand the question first, because coordinating multiple threads is always a little tricky. I don't want to write a lot of example code and explanation about the wrong thing.