Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2004

Tip: Looking for answers? Try searching our database.

A window always on top of another window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sean - 22 Jul 2004 07:38 GMT
Hi all,

Say that I have two windows A and B. When I click a button
on window B, window A will pop up. I want A to be always
on top of B so that user cannot click and fire any buttons
(or any other controls) on Window B as long as Window A
appears.

I cannot use TopMost property because after Form A pops
up, I want another window to be always on top of
Form A (at the sametime I also want Form A to be always on
top of Form B).

                        (top)
                    Another Form (always on top of A)
                          |
                       Form A (always on top of B)
                          |
                       Form B
                       (bottom)

That's why if I use TopMost, I can't get the above to work.
I tried setting
A.Owner = B
but still I can click and fire any button(or controls) on
Form B.

Any help would be greatly appreciated.
Thank you in advance.

regards,
Sean
Mark Broadbent - 22 Jul 2004 07:50 GMT
To get this kind of behaviour you want to open your forms modally.
e.g.
form formA = new form();
FormA.ShowDialog();

Obviously you would open formB in formA's implementation, and so on.

Br,

Mark.

> Hi all,
>
[quoted text clipped - 28 lines]
> regards,
> Sean
Sean - 23 Jul 2004 09:34 GMT
Hi Mark,

Thank you for your help.
Your information is exactly what I need!

regards,
Sean

>-----Original Message-----
>To get this kind of behaviour you want to open your forms modally.
[quoted text clipped - 42 lines]
>
>.
ken@nospam.nospam - 22 Jul 2004 22:12 GMT
Try setting form A's owner property to form B.

To make a form owned by another form, assign its Owner property a reference to the form that will be the owner.
When a form is owned by another form, it is minimized and closed with the owner form. For example, if Form2 is owned by form Form1, if Form1 is closed or minimized, Form2 is also closed or minimized. Owned forms are also never displayed behind their owner form. You can use owned forms for windows such as find and replace windows, which should not disappear when the owner form is selected. To determine the forms that are owned by a parent form, use the OwnedForms property.

> Hi all,
>
[quoted text clipped - 28 lines]
> regards,
> Sean

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.