473,406 Members | 2,633 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.

Setting a child form on top of another that has been activated

Hello:
I have two child forms fChild1 and fChild2, and I want to set and reactivate
fChild2 over fChild1 when fChild1 is activated. I have tried with this code
in frmChild1, but it doesn't work, and now I dont't have any idea about how
to do it.
Can anybody help me, please?
Thanks in advance

private frmChild2 fChild2;
private void button1_Click(object sender, System.EventArgs e)
{
fChild2=new frmChild2();
fChild2.MdiParent=this.MdiParent ;
fChild2.Show();
}
private void frmChild1_Activated(object sender, System.EventArgs e)
{
if (!(fChild2==null))
{
fChild2.TopMost=true;
fChild2.BringToFront();
}
}
Nov 16 '05 #1
2 1092
Jose Egea wrote:
Hello:
I have two child forms fChild1 and fChild2, and I want to set and reactivate
fChild2 over fChild1 when fChild1 is activated. I have tried with this code
in frmChild1, but it doesn't work, and now I dont't have any idea about how
to do it.
Can anybody help me, please?
Thanks in advance

private frmChild2 fChild2;
private void button1_Click(object sender, System.EventArgs e)
{
fChild2=new frmChild2();
fChild2.MdiParent=this.MdiParent ;
fChild2.Show();
}
private void frmChild1_Activated(object sender, System.EventArgs e)
{
if (!(fChild2==null))
{
fChild2.TopMost=true;
fChild2.BringToFront();
}
}


MDI is a concept where there is no topmost or modal form. Any form visible
is part of a global UI which has to be accessable by the user. If you don't
want that, you shouldn't use MDI but SDI with for example dockable windows.

FB

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2
Hi Jose,

Instead of using TopMost, call Activate on fChild2;

Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3

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

Similar topics

9
by: TD | last post by:
I am trying to add transactions to my code. The original code worked fine until I followed an example to setup transactions, now the code does strange things, but no error messages. Could...
2
by: Mystery Man | last post by:
We have an MDI application that is not setting always setting focus to the newly corrected MDI. It is creating the form and it is the topmost but it does not have focus. The code we are using to...
1
by: slaprade | last post by:
I have a MDI form with the following Public fm2 As New Form2() Public fm3 As New Form3() and Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
3
by: O.B. | last post by:
I have a form that shows another child form using the Show() operation. Since the child is modaless, I would like the option that when I click anywhere on the parent form that the parent form...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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...
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...

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.