Is there a way to set a window to the top on screen and set focus on it?
I'm having a menu in VB.Net calling a bunch of .exe. Everytime a window apears, it runs itself to the top on screen. But there was a window, problem-able one, with some .dll which make it always stood behind everthing on screen. I cannot fix the .dll, so I'm trying to get the screen to go to the top with my code.
I tried:
Me.Activate()- Nothing happens...
Me.BringToFront()- Nothing happens...
Me.TopMost = True- Always on top, but no focus (dvmn it!!!)
Please help!

Recommended Answers

All 11 Replies

There is a (very) old forum post on this exact topic.

The (possible) solution can be found here.

Try Form1.Showdialog

@Begginnerdev: Yes, I did saw it, but I couldn't find a possible sulution there :(
@eos.park: It's not the problem whether I use .show() or .showdialog(), it's a problem of a custom .dll which I cannot fix. Anw, thks :)

Did tried them all, at last I decided to fix the .dll. Thing's all fine now :)

Can you share what solution did you used?

Yes, I did used:

Me.TopMost = True 'Then it will bring the form to top
Me.TopMost = False 'Remove .TopMost state so you can work on other forms, too

I thought using the TopMost property is not working?

Yes, TopMost brings you form to top on screen. That means: You'll see your form on top of everything (even windows which not in your project) and unable to bring it to the back later (it's always on top).
I use True first, bring it to front, then False after then so we can bring it to back later if we want.

Okay, Then it's settle. Thanks for the info bro :)

@GeekPlease: No problem, bro.
Marking this as solved so people can see it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.