PC Review


Reply
Thread Tools Rate Thread

BUG?! Visual Studio .NET 2003: Why is a Modal Dialog destroyed?

 
 
=?Utf-8?B?UXVha2VyX0FM?=
Guest
Posts: n/a
 
      28th Jan 2005
I have problem, which is to minimize a WinForm Application with an Open Modal
Dialog.
When the WinForm Application is minimized, then the Modal Dialog is
destroyed. Why?! Bug ?!

Sample:

using System;
using System.Windows.Forms;
class MainForm: Form
{
Timer timer = new Timer();
Form modalForm = new Form();

public MainForm()
{
Button btShowModal = new Button();
btShowModal.Click += new EventHandler(btShowModal_Click);
btShowModal.Parent = this;
timer.Interval = 5000;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}

static void Main()
{
Application.Run(new MainForm());
}

private void btShowModal_Click(object sender, EventArgs e)
{
modalForm.ShowDialog(this);

...when MainForm is minimized, then modalForm is destroyed... ?! BUG ?!;
}

private void timer_Tick(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Normal)
WindowState = FormWindowState.Minimized;
else
WindowState = FormWindowState.Normal;
}
}

I have Visual Studio .NET 2003 and Framework v1.1 SP1.

Kindly solve my problem.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
Guest
Posts: n/a
 
      28th Jan 2005
Modal dialogs stop the process that spawns them. They are chained to that
process. If you spring a modal dialog from a form, and destroy the form,
there is no process, so the modal dialog drops out, as well. It is expected
behavior.

If you want to stop process, but leave the box open, you will have to create
your own classes, as the "boxed" solution will not work.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Quaker_AL" wrote:

> I have problem, which is to minimize a WinForm Application with an Open Modal
> Dialog.
> When the WinForm Application is minimized, then the Modal Dialog is
> destroyed. Why?! Bug ?!
>
> Sample:
>
> using System;
> using System.Windows.Forms;
> class MainForm: Form
> {
> Timer timer = new Timer();
> Form modalForm = new Form();
>
> public MainForm()
> {
> Button btShowModal = new Button();
> btShowModal.Click += new EventHandler(btShowModal_Click);
> btShowModal.Parent = this;
> timer.Interval = 5000;
> timer.Tick += new EventHandler(timer_Tick);
> timer.Start();
> }
>
> static void Main()
> {
> Application.Run(new MainForm());
> }
>
> private void btShowModal_Click(object sender, EventArgs e)
> {
> modalForm.ShowDialog(this);
>
> ...when MainForm is minimized, then modalForm is destroyed... ?! BUG ?!;
> }
>
> private void timer_Tick(object sender, EventArgs e)
> {
> if (WindowState == FormWindowState.Normal)
> WindowState = FormWindowState.Minimized;
> else
> WindowState = FormWindowState.Normal;
> }
> }
>
> I have Visual Studio .NET 2003 and Framework v1.1 SP1.
>
> Kindly solve my problem.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to take an IE rendered screenshot of a website with visual studio .net 2002 or visual stuido .net 2003? I can't install visual studio .net 2005 on this computer. Daniel Microsoft Dot NET 4 17th May 2007 07:56 PM
How to take an IE rendered screenshot of a website with visual studio .net 2002 or visual stuido .net 2003? I can't install visual studio .net 2005 on this computer. Daniel Microsoft Dot NET Framework 1 14th May 2007 08:05 PM
How to take an IE rendered screenshot of a website with visual studio .net 2002 or visual stuido .net 2003? I can't install visual studio .net 2005 on this computer. Daniel Microsoft C# .NET 0 14th May 2007 07:45 PM
BUG?! Visual Studio .NET 2003: Why is a Modal Dialog destroyed? =?Utf-8?B?UXVha2VyX0FM?= Microsoft Dot NET Framework Forms 0 28th Jan 2005 09:43 AM
Installing Visual Studio 6 AFTER Visual Studio 2003 trial and Office 2003 - Is it safe? Dave Smithz Microsoft Dot NET 1 30th Jun 2004 08:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:20 AM.