Hi,
I have a Windows Forms client that calls a web service both synchronously
and asynchronously. If a certain value is returned, I pop up a MessageBox
to the user, and wait for their answer. I set a timer before the window
opens to make sure something happens within a time period. If the timer
does in fact pop, I call this.Close() on the form to close the app.
When the timer pops after a synchronous call to the web service, the close
causes the MessageBox to close, and the Application terminates. But if the
call to the web service is async, a call to this.Close() in the timer
elapsed function closes the form, but the MessageBox remains open (and
subsequently, the app remains resident).
Sync:
------
Call Web Service Sync
Examine result
Set Timer
Open Message Box
Timer Pops
this.Close()
MessageBox Closes, and Application Sucessfully Exits
Async:
-------
Call Begin_Web Service (async)
Async Callback Called
Delegate function invoked
Examine result
Set Timer
Open MessageBox
Timer Pops
this.Close()
Form closes, but MessageBox remains open until user intervention, leaving
the app running.
...
Does anyone have an explanation and method to get the message box to close
(and the app to exit) in the Async case?
Thanks,
-Paul
Paul - 20 Jan 2005 13:51 GMT
I think I have solved it, although I still have a bit more testing to do. I
was not passing the Form's window handle as the first parameter to the
MessageBox.Show(). I guess it doesn't close the message box as a child
window sometimes when that parameter is passed.
-Paul
> Hi,
>
[quoted text clipped - 45 lines]
>
> -Paul
Tia - 20 Nov 2005 15:35 GMT
START YOUR OWN E-MAIL BUSINESS TODAY and TAKE ADVANTAGE OF THE FOLLOWING:
1.ALL CUSTOMERS PAY YOU IN CASH!!!
2. TOP PART-TIME OWNERS HAVE EARNED $5,000+ IN ONE MONTH!
3. TOP FULL-TIME OWNERS HAVE EARNED $10,000+ IN ONE MONTH!
4. YOU WILL SELL A PRODUCT WHICH COSTS NOTHING TO PRODUCE!
5. YOUR MAIN OVERHEAD IS YOUR TIME!
6. YOUR START UP COSTS ARE LESS THAN $25
7. YOU HAVE MORE THAN 40 MILLION POTENTIAL CUSTOMERS
For additional information please E-mail me at saita@dodo.com.au
=====================================================
New Software that finds leads for YOU for F.R.E.E.!!!!!
http://www.contactthem.com/cgi-bin/at.cgi?a=316161
---
MAF Anti-Spam ID: 20051113184547I1n0UmZ7