Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

Async Web service and Form Close()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 14 Jan 2005 15:23 GMT
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 - 44 lines]
>
> -Paul

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.