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 / April 2005

Tip: Looking for answers? Try searching our database.

Handling dialog results in deeply nested call stacks

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SSI Developer - 08 Apr 2005 17:13 GMT
If a form returns a dialog result and it can be handled immediately, then you
can just check for the result and proceed accordingly.

However, if the result of a dialog has to be returned from a deeply nested
method in the call stack to the original caller in the call stack, what is
the best way to do it?

I can think of a couple but I see major problems with them.

1. Throw an exception and catch it at the caller.  Problem: Using exceptions
as control flow constructs is a bad idea.  Exception handling is
computationally expensive.

2. Return the result from the top of the stack to the original caller, one
layer of the stack at a time.  Problem: Hard to maintain with multiple many
return calls throughout the stack.
Axel Dahmen - 11 Apr 2005 14:51 GMT
How about providing a listener delegate function (callback) at the caller
object?

HTH,
Axel Dahmen

------------------------------------
> If a form returns a dialog result and it can be handled immediately, then you
> can just check for the result and proceed accordingly.
[quoted text clipped - 12 lines]
> layer of the stack at a time.  Problem: Hard to maintain with multiple many
> return calls throughout the stack.

Rate this thread:







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.