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

Home Posts Topics Members FAQ

ShowDialog, Show and Disposed

Hi

I'm working on a program that will have 3 forms: a main form, a status
form and a sub-form.

The main form and status form are always appear, and my sub-form is a
singleton (for performance issue).

As usual, I have two ways to display the sub-form: Show() and
ShowDialog().
When I use ShowDialog() (the main form calls it), the program works
fine but I cannot access the main form and the status form (also
called by the main form). Because I still want to have access to the
other forms, I have to use Show()

But my program will crash with Show() because unlike ShowDialog(),
when the form that opened with Show() is closed, the form is also
disposed. This is not what I wanted because it's a singleton and I
want it to be disposed when the main form closed (the whole program
terminates).

I think I should override an event to suspent the Disposing but I
can't find which event I should use, and how would I do it. Any help
is welcome.

Best Regards,
Homa Wong
Nov 15 '05 #1
0 1597

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

Similar topics

5
3862
by: MrNobody | last post by:
I am using the no-arg ShowDialog() method hoping that the window would not be modal to any other window like the other ShowDialog(IWin32Window) method does, but when this opens it somehow becomes modal to my main window- even though I don't see how it could even be getting a reference to my main window. What I need is to open a new window but still have my main window available for interaction- the way it opens now it forces focus on this...
1
1155
by: e | last post by:
It would be a long and bizzare post to explain how I found it, but, in a nutshell... I have a main app. I have 2 "wizard" forms which I always .ShowDialog so they're modal. Sometimes, Wizard B needs to be called from Wizard A. This is the only time any wizard can call the other. This creates a situation where I have Wizard A being shown as dialog over the main app, and Wizard B is being shown as dialog over Wizard A.
5
1586
by: Josh Golden | last post by:
3 forms. form 1, when button clicked instantiates form 2 which opens but is not shown. form 2 instantiates form 3 as showdialog. form 3 finishes, raises an event that form 2 catches. during the catch, form 2 closes and disposes the instance of form 3, opens itself as showdialog, and displays some data to the user. the user can select one of these data and upon doing so raises an event that form 1 catches (and closes and disposes of...
4
4389
by: Dennis Sjogren | last post by:
Greetings! First, I'm not 100% sure where to post this question. I use VB.NET for this project, but it's really a design question (a question on which method to use when solving this problem). In this medium sized (30 or so forms) application, our users have requested a more visual notification of when the client (this app) is communicating with the server, or for other lenghty processes. Disabling the current form and changing the...
4
5843
by: Jm | last post by:
Hi all Im not sure of the best way to be displaying my forms and just want a bit of clarification. Being only recently moved to vb.net im still used to the old vb6 form.show method, now under vb.net that doesnt seem to do alot most of the time so far as i can tell. So im using form.showdialog all the time. But it seems as though once i call this code, all control transfers to the open form and only when closed the control returns to the...
4
12374
by: randy1200 | last post by:
I have a SideForm. If the use presses a button on the main form, the side form comes up by executing the following: SideForm sf = new SideForm() sf.ShowDialog(); This works perfectly. I've been asked to change the code to the following:
11
4212
by: osmarjunior | last post by:
I have a sequence of commands like this: Form1 frm = new Form1(); frm.LoadData(); Boolean confirm = (frm.ShowDialog() == DialogResult.OK); The LoadData method loads information from database. The problem is, when I was debugging the application, it doesn't show the form. It just pass through the ShowDialog() method, and my flag confirm becomes
2
2124
by: NickP | last post by:
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(...SW_HIDE).
8
11597
by: Joe Duchtel | last post by:
Hello - I have the following code to detemine a file name when my application is saving a file. The problem is that if the file already exists and I select the Yes button in the "Do you want to replace" dialog, the DialogResult is Cancel instead of OK. Is there something I am missing? Dim lSaveFileDialog As New SaveFileDialog
0
8303
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,...
0
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8723
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8502
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
8602
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
7316
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
5632
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();...
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.