473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Multiple Forms

I have two forms (Help and About).

How can I prevent one of the forms from being displayed when the other form
is currently displayed?

They are rendered from menu selections using ...

private void mnuHelp_Click( object sender, System.EventArgs e )
{
Form frm = new frmHelp( );
frm.ShowDialog( this );
}

private void mnuAbout_Click( object sender, System.EventArgs e )
{
Form frm = new frmAbout( );
frm.ShowDialog( this );
}

What was the source of your information?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 16 '05 #1
2 1406
mdb
"Thom Little" <th**@tlanet.net> wrote in
news:Oe**************@TK2MSFTNGP12.phx.gbl:
I have two forms (Help and About).

How can I prevent one of the forms from being displayed when the other
form is currently displayed?

They are rendered from menu selections using ...

private void mnuHelp_Click( object sender, System.EventArgs e )
{
Form frm = new frmHelp( );
frm.ShowDialog( this );
}

private void mnuAbout_Click( object sender, System.EventArgs e )
{
Form frm = new frmAbout( );
frm.ShowDialog( this );
}

You could disable each menu item before the ShowDialog calls... eg...

private void mnuHelp_Click( object sender, System.EventArgs e )
{
Form frm = new frmHelp( );
mnuAbout.Enabled = false;
frm.ShowDialog( this );
mnuAbout.Enabled = true;
}

and

private void mnuAbout_Click( object sender, System.EventArgs e )
{
Form frm = new frmAbout( );
mnuHelp.Enabled = false;
frm.ShowDialog( this );
mnuHelp.Enabled = true;
}

-mdb
Nov 16 '05 #2
Excellent suggestion. It was also allowing multiple copies of the forms to
be spawned. Using your approach I solved both problems with ...

private void mnuHelp_Click( Object sender, System.EventArgs e )
{
Form frm = new frmHelp( );
private_ShowDialog( frm );
}

private void mnuAbout_Click( Object sender, System.EventArgs e )
{
Form frm = new frmAbout( );
private_ShowDialog( frm );
}

private void private_ShowDialog( Form frm )
{
this.mnuContext[3].Enabled = false ;
this.mnuContext[4].Enabled = false ;
frm.ShowDialog( this );
this.mnuContext[3].Enabled = true ;
this.mnuContext[4].Enabled = true ;
}

Thanks for the help.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com> wrote in message
news:Xn****************************@207.46.248.16. ..
"Thom Little" <th**@tlanet.net> wrote in
news:Oe**************@TK2MSFTNGP12.phx.gbl:

You could disable each menu item before the ShowDialog calls... eg...

private void mnuHelp_Click( object sender, System.EventArgs e )
{
Form frm = new frmHelp( );
mnuAbout.Enabled = false;
frm.ShowDialog( this );
mnuAbout.Enabled = true;
}

and

private void mnuAbout_Click( object sender, System.EventArgs e )
{
Form frm = new frmAbout( );
mnuHelp.Enabled = false;
frm.ShowDialog( this );
mnuHelp.Enabled = true;
}

-mdb

Nov 16 '05 #3

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

Similar topics

22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
0
by: jon | last post by:
Using Visual C++ and MFC, one could generate a very nice MMI using CFormView and the method detailed in the MSDN "vswap" example to allow multiple forms to be viewed ( switched to ) within a single...
6
by: mark | last post by:
I have an asp.net ecommerce web application on a remote web server. I'm using an Access database on the back end. I've notice a few strange things. When I mimic an multiple user environment by...
1
by: Rob | last post by:
I have an ASP.NET application that uses forms-based authentication. A user wishes to be able to run multiple sessions of this application simultaneously from the user's client machine. The...
2
by: John Granade | last post by:
I'm looking for the best way to make a dataset available from multiple Windows forms. The dataset is created from an XML file. I have a main form (frmMain) that loads the dataset and reads the...
6
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those...
3
by: imrantbd | last post by:
I need array type name like "destList" must use for my destlist select box,not a single name.Or need a solution to capture multiple value of "destList" select box and send all selected value in php...
5
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
5
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.