views:

87

answers:

1

I'm using Visual Basic 2010 Express. I have a form that can be minimized. There's also a tray icon. I've coded it so that if you double-click on the tray icon, the form's FormWindowState becomes set to Normal; this restores the form to where was before it became minimized, but the form does not become the active window on my desktop.

How can I make the form become the active most foreground window? I've tried various functions that I can think of but no luck yet. Tried searching with various queries to try and find the right wording but no luck.

I'm new to Visual Basic - only started a couple hours ago.

Probably something simple but I can't seem to find the correct function or anything... Please enlighten me! Thanks.

Edit for further info: Say I have the form/window open, and then I overlap said form with a window of another application. When I double-click my app's tray icon, I want my window to become the active window, bringing it to the front, but can't figure out how >_<

A: 

Try Form.Activate()

Michael
Seems you've deleted your previous comment, Michael... Form.Activate() ended up doing the trick. Thanks!
Chris
OK, set it back! Cool.
Michael
Yes, whether it's minimised or hiding behind another application's window, it activates it and brings it to the foreground. Cheers.
Chris