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 / December 2004

Tip: Looking for answers? Try searching our database.

ShowDialog and Thread

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elp - 04 Dec 2004 00:18 GMT
Hi,

A probably trivial question but i can't figure out the answer  myself.

When you call ShowDialog() on a Form to display it modaly, the code located
after the ShowDialog call is not executed until the Form is closed. So it
looks like the thread in which the form runs is frozen or asleep. Of
course, it is not as the form still processes events and you can call
mehtods from this Form, etc. So what really happens when you call
ShowDialog? How come the code after it is not immediately executed? If the
ShowDialog method was just waiting for the form to be closed, the UI thread
would be frozen which is not the case. I'm sure i'm missing something
simple but what?

Thanks.
Christopher Kimbell - 05 Dec 2004 16:36 GMT
Each program has one UI thread, this thread is responsible for processing
messages for all UI objects.
When you use the ShowDialog(), the dialog is shown in a modal state, you
have told the system that
no other window in your application can receive events. If you want a
modeless dialog, use the Show()
method instead, then both dialogs can receive messages at the same time

The same happens when you use the MessageBox class, this displays a modal
dialog. All other
processing stops until the button is pressed.

Chris

> Hi,
>
[quoted text clipped - 13 lines]
>
> Thanks.

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.