|
-
Jun 1st, 2019, 11:59 AM
#1
Thread Starter
Addicted Member
[RESOLVED] How do you make the current form topmost?
I am aware that you can set the form to topmost (Me.Topmost=True), but I want the CURRENT form to be on top. I have set the startup form as my Home form, which has buttons to 2 other forms, which have Me.Topmost=True set on each of them, but the Home form is always on top, even though I did not set it as topmost.
Any idea why the new forms I open do not come to the front?
-
Jun 1st, 2019, 12:07 PM
#2
Re: How do you make the current form topmost?
If you have set TopMost to True for one form and False for another then the first form will be displayed over the second. If that's not what you're seeing then either you haven't set those properties that way or your system is broken. There's no other magic property that we can tell you to set that will "fix" this issue because TopMost already does what TopMost does. Perhaps you could demonstrate to us how we can reproduce the issue because, without that, there's not really any way that we can tell you how to fix an issue that doesn't appear could possibly exist.
-
Jun 1st, 2019, 12:38 PM
#3
Thread Starter
Addicted Member
Re: How do you make the current form topmost?
I think I know where I have gone wrong! After writing this post and giving up for today I realised that I had been putting Me.Topmost=True on the Home form after the Show() command, whereas I should have put the command on each of the forms or perhaps used the name of the form instead of Me.
-
Jun 1st, 2019, 07:34 PM
#4
Re: How do you make the current form topmost?
If you want every instance of a particular form type to be on top by default then you should set the TopMost property to True for that form type in the designer, just like you set the Text or any other common property. If you want any particular instance to behave other than the default then you should be setting the TopMost property of that instance before showing it, e.g.
vb.net Code:
'Display a specific instance of Form2 on top when Form2 is not on top by default. Dim f2 As New Form2 f2.TopMost = True f2.Show() 'Display the default instance of Form3 not on top when Form3 is on top by default. Form3.TopMost = False Form3.Show()
The only time you should be setting TopMost of the current instance is if you have something within that form that would cause the property to change, e.g. the 'Always on top' item under the 'Options' menu in the Windows 'Task Manager' app.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|