Question Make a Form TopMost but only when an other Form is opened

Beware

Member
Joined
Dec 4, 2012
Messages
7
Programming Experience
3-5
Hi! I'm new on the forum here so don't be to hard on me :)
Im busy with a schoolproject. Im making a Visual OS in VB.Net.
My problem is that i want to make a Form TopMost but only when a specific othe Form is opened.
Screen 1,2,3 are Form1,2,3
I've made an app: Form 4
When I open the app on Screen 2(Form2) it needs to stay on that form, even when i switch to the other screen.
I use this code for Form4(The app):
Me.TopMost = True
But Im looking fore something like:
If Form2.Show = True Then
Me.TopMost = True
Can anybody help me with this?

thanks in advance
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,540
Location
Norway
Programming Experience
10+
it needs to stay on that form, even when i switch to the other screen.
What does that mean? Maybe you should use ShowDialog to show the form as a dialog?
 

Beware

Member
Joined
Dec 4, 2012
Messages
7
Programming Experience
3-5
What does that mean? Maybe you should use ShowDialog to show the form as a dialog?

This is wat I mean:
Test.jpg

An application is opened. Im on screen 3 here. When I got to screen 2 the application is still opened but then on screen 2.
What I want is that the application stays open but keeps staying on screen 3 where i opened it.
So the application is kind of locked to screen 3 at that moment.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,540
Location
Norway
Programming Experience
10+
So why give user the 'switch to' options when you don't want to allow user to make a switch?
 

Beware

Member
Joined
Dec 4, 2012
Messages
7
Programming Experience
3-5
I need the 'switch to' option because i don't have a taskbar that shows whichs applications are opened.
So I the application that I made can't minimalize but because I can't minimalize them I need multiple screens because otherwise the screen is to full when you've opened multiple applications.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,540
Location
Norway
Programming Experience
10+
It is a context menu so you can have different choices in different contexts. In the context you're discussing here it seems to me that choice should not be enabled.

While I find your description somewhat confusing, it may also be possible you're talking about something else entirely, in which case a possible solution is to set Owner of the child form that should belong to a particular screen (form) or add it to the screens OwnedForms collection. Form.Owner Property (System.Windows.Forms)
 

Beware

Member
Joined
Dec 4, 2012
Messages
7
Programming Experience
3-5
I've found a solution, i just don't make multi-screen. It gives to much problems and I already have a better way of opening the applications :)
 
Top Bottom