473,738 Members | 6,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Forms - Opening forms within forms

In my application I have a form (Customer) that I want to be able to open
multiple copies at once. Within this form I have other forms that can be
opened. Example: ZipCode. When the user enters a zipcode that is unknown
this form will open. I don't want users to modify any of this customers
data until they close the zipcode form. Normally this can accomplished
using a modal form, however this prevents me from opening a new copy of the
Customer form while the zipcode form is open.

How do you normally go about handling this scenario ?
--
Thanks,
Dan Tallent

Aug 26 '08 #1
21 3376
On Aug 26, 8:58*am, "Dan Tallent" <s...@microsoft .comwrote:
In my application I have a form (Customer) that I want to be able to open
multiple copies at once. *Within this form I have other forms that can be
opened. Example: ZipCode. * *When the user enters a zipcode that is unknown
this form will open. * I don't want users to modify any of this customers
data until they close the zipcode form. * Normally this can accomplished
using a modal form, however this prevents me from opening a new copy of the
Customer form while the zipcode form is open.

How do you normally go about handling this scenario ?

--
Thanks,
Dan Tallent
I guess use a modeless form. Or, use a class in lieu of using
forms.

RL
Aug 26 '08 #2
I knew it must be a modeless form, otherwise the entire application is stuck
waiting.

As far as "use a class"...what do you mean? All objects are classes of
some kind.

This code
Child1 C = new Child1();C.Star tPosition = FormStartPositi on.CenterParent ;

C.TopLevel = false;

C.Parent = this;

C.Top = (this.Height - C.Height) / 2;

C.Left = (this.Width - C.Width) / 2;

C.Show();

C.BringToFront( );



"raylopez99 " <ra********@yah oo.comwrote in message
news:5b******** *************** ***********@v26 g2000prm.google groups.com...
On Aug 26, 8:58 am, "Dan Tallent" <s...@microsoft .comwrote:
In my application I have a form (Customer) that I want to be able to open
multiple copies at once. Within this form I have other forms that can be
opened. Example: ZipCode. When the user enters a zipcode that is unknown
this form will open. I don't want users to modify any of this customers
data until they close the zipcode form. Normally this can accomplished
using a modal form, however this prevents me from opening a new copy of
the
Customer form while the zipcode form is open.

How do you normally go about handling this scenario ?

--
Thanks,
Dan Tallent
I guess use a modeless form. Or, use a class in lieu of using
forms.

RL
Aug 26 '08 #3
Unfortunately this code still allows the user to modify the part form. If
I set Enabled = false on the parent form it also kills the child form.

Any ideas?

Thanks
Dan


"Dan Tallent" <sp**@microsoft .comwrote in message
news:OU******** ******@TK2MSFTN GP02.phx.gbl...
>I knew it must be a modeless form, otherwise the entire application is
stuck waiting.

As far as "use a class"...what do you mean? All objects are classes of
some kind.

This code
Child1 C = new Child1();C.Star tPosition = FormStartPositi on.CenterParent ;

C.TopLevel = false;

C.Parent = this;

C.Top = (this.Height - C.Height) / 2;

C.Left = (this.Width - C.Width) / 2;

C.Show();

C.BringToFront( );



"raylopez99 " <ra********@yah oo.comwrote in message
news:5b******** *************** ***********@v26 g2000prm.google groups.com...
On Aug 26, 8:58 am, "Dan Tallent" <s...@microsoft .comwrote:
>In my application I have a form (Customer) that I want to be able to open
multiple copies at once. Within this form I have other forms that can be
opened. Example: ZipCode. When the user enters a zipcode that is unknown
this form will open. I don't want users to modify any of this customers
data until they close the zipcode form. Normally this can accomplished
using a modal form, however this prevents me from opening a new copy of
the
Customer form while the zipcode form is open.

How do you normally go about handling this scenario ?

--
Thanks,
Dan Tallent

I guess use a modeless form. Or, use a class in lieu of using
forms.

RL

Aug 26 '08 #4
I'm sure there are other options, but you could have the Customer form have a
private instance of a Zipcode form. When the Customer form needs the Zipcode
form, it makes it visible. Change the enabled property of the Customer form
to false when the Zipcode form is shown. Add a handler for when the Zipcode
form is made invisible (VisibilityChan ged), at which point the Customer form
becomes enabled.

"Dan Tallent" wrote:
In my application I have a form (Customer) that I want to be able to open
multiple copies at once. Within this form I have other forms that can be
opened. Example: ZipCode. When the user enters a zipcode that is unknown
this form will open. I don't want users to modify any of this customers
data until they close the zipcode form. Normally this can accomplished
using a modal form, however this prevents me from opening a new copy of the
Customer form while the zipcode form is open.

How do you normally go about handling this scenario ?
--
Thanks,
Dan Tallent

Aug 26 '08 #5
Thanks for your reply.

I thought of something similar that when the ZipCode form was opened it
disabled the Customer form. The customer form subscribed to the FormClosed
event of the Zipcode form. This seems to work but it does have some
problems.
1 The Customer form can't be minimized or moved.
2 The Zipcode form can be moved outside the range of the Customer (parent)
form.
3 When you open a couple of customer forms it difficult (from a user point
of view) to tell which Customer screen the ZipCode is associated with.

If I could find a way to prevent the user from moving the ZipCode form
outside the boundries of the Customer form this would work perfectly. I
tried making the Customer form the parent, but when I disable the Customer
form the Zipcode form is disabled as well.

Thanks
dan

"Family Tree Mike" <Fa************ @discussions.mi crosoft.comwrot e in
message news:14******** *************** ***********@mic rosoft.com...
I'm sure there are other options, but you could have the Customer form
have a
private instance of a Zipcode form. When the Customer form needs the
Zipcode
form, it makes it visible. Change the enabled property of the Customer
form
to false when the Zipcode form is shown. Add a handler for when the
Zipcode
form is made invisible (VisibilityChan ged), at which point the Customer
form
becomes enabled.

"Dan Tallent" wrote:
>In my application I have a form (Customer) that I want to be able to open
multiple copies at once. Within this form I have other forms that can be
opened. Example: ZipCode. When the user enters a zipcode that is
unknown
this form will open. I don't want users to modify any of this customers
data until they close the zipcode form. Normally this can accomplished
using a modal form, however this prevents me from opening a new copy of
the
Customer form while the zipcode form is open.

How do you normally go about handling this scenario ?
--
Thanks,
Dan Tallent


Aug 26 '08 #6
Why don't you try redesigning abit. Make the "ZIP form" a user
control. Then on your Customer form center a hidden by default panel.
Then when your logic requires it, Show that panel while disabling the
rest of the controls behind it. The Customer form can still be
minimized, the ZIP *panel* is really part of form's layout, so no
confusion which ZIP panel belongs to which Customer form...
Will that work?
Aug 26 '08 #7
I looked into this method as well. I found I could use a form for the
ZipCode just as easily. The zipcode form can have its Parent set to the
Customer form which elimates the confusion. The form stays within the
boundry of the Customer form, and the Customer (parent) form can still be
minimized. The trick would be that I would need to write code to disable
all of the controls on the form manually. I have older apps that I've done
this with, but I was thinking I was doing this the hard way.

I suppose I could write a routine to loop though all the controls on the
form to disable/enable them. The problem there would be during the enable
knowing which controls should remain disabled.

Thanks for help. All suggestions are appreciated.
Dan


"G.S." <gs******@gmail .comwrote in message
news:22******** *************** ***********@c65 g2000hsa.google groups.com...
Why don't you try redesigning abit. Make the "ZIP form" a user
control. Then on your Customer form center a hidden by default panel.
Then when your logic requires it, Show that panel while disabling the
rest of the controls behind it. The Customer form can still be
minimized, the ZIP *panel* is really part of form's layout, so no
confusion which ZIP panel belongs to which Customer form...
Will that work?

Aug 26 '08 #8
On Aug 26, 10:08*am, "Dan Tallent" <s...@microsoft .comwrote:
This code
Child1 C = new Child1();C.Star tPosition = FormStartPositi on.CenterParent ;

C.TopLevel = false;

C.Parent = this;
Well there's your problem right there Dan. You are creating a
potential circular reference with the 'this' pointer on the RHS. By
the logic of your program (if I'm reading it correctly), the child
form has a member variable Parent, and you are essentially saying the
parent is the child. For the root node (first parent to every form,
or Form 1) I guess this is OK, but for every other subform it's not.

Did you program the lunar module that landed (or didn't) on Mars by
any chance?

RL
Aug 26 '08 #9
Have you tried making Customer be an MDI Container? It won't work if
Customer is contained within an MDI Container, but it sounds like what you
are after.

"Dan Tallent" <sp**@microsoft .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I looked into this method as well. I found I could use a form for the
ZipCode just as easily. The zipcode form can have its Parent set to the
Customer form which elimates the confusion. The form stays within the
boundry of the Customer form, and the Customer (parent) form can still be
minimized. The trick would be that I would need to write code to disable
all of the controls on the form manually. I have older apps that I've done
this with, but I was thinking I was doing this the hard way.

I suppose I could write a routine to loop though all the controls on the
form to disable/enable them. The problem there would be during the
enable knowing which controls should remain disabled.

Thanks for help. All suggestions are appreciated.
Dan


"G.S." <gs******@gmail .comwrote in message
news:22******** *************** ***********@c65 g2000hsa.google groups.com...
>Why don't you try redesigning abit. Make the "ZIP form" a user
control. Then on your Customer form center a hidden by default panel.
Then when your logic requires it, Show that panel while disabling the
rest of the controls behind it. The Customer form can still be
minimized, the ZIP *panel* is really part of form's layout, so no
confusion which ZIP panel belongs to which Customer form...
Will that work?

Aug 26 '08 #10

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

Similar topics

2
7526
by: dsnyder | last post by:
This HTML has a bit of Javascript at the end that puts the initial focus on the userID field. It works great on Windows2000 running IE6, but the initial focus never goes to the userID field on Windows 2003 PocketPC (Windows Mobile) running Pocket IE. <html><head><title>WMS - P280WF100 - Login</title><META HTTP-EQUIV='expires' VALUE='0'> </head> <body> <form name="frmLogon" action='p280wp100' method='get'>
4
2628
by: Jelmer | last post by:
Hi I've been trying to create an addin similar to Find & Replace from Rick Fisher that looks thru your tables / queries / forms / modules etc.. for a reference to a string and optionally let's you replace it. In order to get this to work I need to get - the tablenames and columnnames - the queries in plaintext - the properties of a form and the properties of elements contained within it
19
6008
by: Lauren Quantrell | last post by:
In Windows XP display Properties/Appearance users can chose between: Windows XP Style or Windows Classic Style. Is there a way in VBA to determine the user's selection? The reason: Toolbars size taller in XP than in Classic so I need to size all those nifty windows sizing commands depending on the user's preference.
3
14355
by: Vitaly Zayko | last post by:
Is it possible to attach a form (C# .NET 2) to windows service and show it in OnStart event? When I tried to do this in general (new, Show()) way it just didn't do anything nor gave me any errors. I want to use this form for interaction with the service. Thanks! Vit Zayko
3
1365
by: TheSteph | last post by:
Using : VS 2005, .NET 2.0, Windows Form, Win 2k I have a strange problem in VS : When I open some forms all the files (resx and cs) of this form are immediately marked as modified (an * following the file name in the tab of the IDE). So if I open one these form and immediately close it, VS ask me if I want to save the changes.and that's quite annoying because in some case I'm not sure if I modified the file or if it's VS that did it. ...
2
2418
by: Budhi Saputra Prasetya | last post by:
Hi, I managed to create a Windows Form Control and put it on my ASP .NET page. I have done the suggestion that is provided by modifying the security settings. From the stack trace, I would assume that the code throws exception when it is trying to retrieve the processes list that has certain name. Below is the code that I use to retrieve the processes. Process processes = Process.GetProcessesByName("xxxx");
0
2060
by: Budhi Saputra Prasetya | last post by:
Hi, I still have the same problem with embedding Windows Control. I'll just requote what I posted last time: I managed to create a Windows Form Control and put it on my ASP .NET page. I have done the suggestion that is provided by modifying the security settings. From the stack trace, I would assume that the code throws exception when it
5
3306
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
9
1803
by: Scott Stark | last post by:
Hello, I'm *just* delving into Windows forms-based programming without the benefit of any books, etc. I have a background in light ASP.NET work, so forgive me if this is a really basic question related to Windows GUI. I've created a "Form1.vb" file in my project, added a menustrip, etc. When a user clicks on a menu item, how do I get it to show a new form in the same window?
0
8787
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
9473
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...
1
9259
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
9208
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
8208
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
6750
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...
1
3279
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
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.