Ok kkkk promise to fix the name of Button.
But I still have doubts is like MyOtherMethod () to do the check when Private Sub btn_Click (blah, blah) Handles btn.Click end its process
I'm trying to do is this
1 - click on the button
2 - click on the button triggers the event Private Sub btn_Click (blah, blah) Handles btn.Click
3 - The btn.Click event triggers the routine MyOtherMethod () the btn.Click however, have to continue running the remaining code
4 - MyOtherMethod () loop is waiting for the end of btn.Click
5 - When the event finished btn.Click, MyOtherMethod () loop that identifies that event ended btn.Click and runs a code that is out of the loop and ends
What i am not able to do is, call event btn.Click MyOtherMethod () and continue running the rest of the code, which waits btn.Click MyOtherMethod () finish to continue
and also I am not able to make the MyOtherMethod () identifies which ended btn.Click
OK, you didn't get it. There is NO other code after the call to MyOtherMethod. That is the last thing that happens inside the event handler.
I serisouly doubt you need to go call some method, then have it wait on the rest of the code in the handler to finish. It WILL NOT ever finish until the method you called finishes itself.
It sounds as though you need to restructure what you're doing, synchronously, to avoid this situation. When you make a method call, the code that does the calling does NOT continue to run while the method is executing. The calling code completely stops and waits for the method called to return. This is called a "blocking call".
Also, event handlers should return inside of about 250 milliseconds. While your event handler code is exectuing, your UI is copmletely hung waiting for it. The user cannot click on anything in your app until the handler returns.
But, in any case, the ONLY way to do what you describe to is use threading and a WaitHandle to signal the other thread. So, your event handler gets called, and in it you kick off another thread.
What are you doing that you think you need to do this??