473,657 Members | 2,753 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding dialog causes ShowDialog to return

Hi there,

I was wondering if there was any way to stop the hiding of a dialog from
returning from the ShowDialog function?

i.e. If you create your own dialog and put some code in that hides it
temporarily during it's use, the ShowDialog function will return the second
it is hidden, this is the same for ".Hide()" as well as sending
ShowWindow(...S W_HIDE).

Many thanks in advance!

Nick.
Nov 30 '06 #1
2 2123
Hiding a dialog you have shown with ShowDialog obviously causes it to return
because ShowDialog is Modal (modal dialog is one which blocks input to all
other toplevel windows). What you want to do is "Show" the dialog, but to
hold a reference to it in your form class, otherwise it will dissapear when
it gets disposed (on exit from the method which created it).

Nov 30 '06 #2
Hi there,

Yes I understand why it does it, but technically the form has not been
closed. As a temporary "fix" I have moved the form offscreen while the user
finishes the operation.

I was hoping I could have got around it without blocking the calling
thread manually but I guess I can't. Many thanks for your advice.

Nick.

"Robinson" <to************ ******@myinboxt oomuchtoooften. comwrote in
message news:ek******** ***********@new s.demon.co.uk.. .
Hiding a dialog you have shown with ShowDialog obviously causes it to
return because ShowDialog is Modal (modal dialog is one which blocks input
to all other toplevel windows). What you want to do is "Show" the dialog,
but to hold a reference to it in your form class, otherwise it will
dissapear when it gets disposed (on exit from the method which created
it).

Nov 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3423
by: John Bowman | last post by:
Hi, I need some dialog handling help, I must be missing something obvious here but I can't figure out the solution to the following problem... Simple Win Forms app that has button on the form. The click event handler for the button creates another dialog (as a form object) and calls it's ShowDialog method to dsiplay it modally. The secondary dialog then appears that has OK and Cancel buttons and the user can interact as expected. Now...
2
11658
by: Mark Broadbent | last post by:
I know this has been discussed before, but rather than spend ages trawling through old threads I thought I would start a new *quick* Q&A thread. Q. What is the preferred method for returning data from a dialog to a parent form. Previously when I have been launching a dialog, I would pass a reference to it's parent form in the ShowDialog method e.g. myDialog.ShowDialog(this) from within the dialog I return the data by obtaining a...
6
3838
by: bryanhobson | last post by:
I'm fairly new to c#, and I am just trying to work out how a 'properties' dialog works. Currently in my code, I have an object represented by the class 'Dog'. The dog object has several properties. I have added a new windows form, class 'DogProperties'. I'm attempting to use this to allow the user to edit the properties of an instance of 'Dog'.
4
2707
by: ronenk | last post by:
I have this code to load an authentication form once my app is loaded. I want the authentication form to be closed if a user is authenticated successfully and to give the option to close app on his decision. private void MainForm_Activated(object sender, EventArgs e) { AuthFrm StartUpfrm = new AuthFrm(); if (StartUpfrm.ShowDialog() == DialogResult.OK)
4
1901
by: Tony Vitonis | last post by:
Hello. I've written an app that I want to "live" in the system tray. I want it to start up with just a tray icon showing, and if the user selects "Settings..." from the icon's context menu, to display a window that will allow him to change settings. When he hits "OK" or "Cancel", the window should hide again. At first, I tried putting a "Me.Visible = False" in the form's Load event, but apparently that code runs before the command can...
14
3762
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
2
1435
by: Bob | last post by:
Hi, I have an app that requires 4 child forms each created on a separate thread. Each form holds a 3rd Party Phone answering control. The control will only answer the phone if the form has been displayed. Instantiating the form is not enough. The only way I have been able to display the form(s) is myForm.ShowDialog(); myForm.Show() does nothing. (Code snippet below.) So... I can't issue a hide instruction as the calling code is waiting...
2
22113
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I select the print directly option, it also prints right away to the defauilt printer. However, if I use the printer dialog control to print and I click 'OK' to actually print the document - nothing happens. The job does not even go into the print...
7
5585
by: Masterfrier | last post by:
Hi there! in my app, i open a Dialog, in this dialog i use the FileOpenDialog, when i click on 'Ok' or 'Cancel' in my FileOpenDialog, it automatically closes the parent dialog, with a DialogResult.Cancel??? I have overloaded the ShowDialog to accept parameters in the 'Parent' Dialog main Code ...Calling Parent Dialog
0
8382
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8498
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8600
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.