Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

How do i get my window that isn't focused in focus and on top? I have tried .Focus, .Activate, SetForegroundWindow API, .BringToFront. All that happens is the taskbar flashes until i click it and bring it to the foreground.

 

Why? Help. I need the form to get focus!

Posted

Hey,

 

Did you try to set the TopMost property of your form to be true?

 

You could do this at the time when you want the form to be in front of all other forms (given they don't have this prop. set to true)...

IS
Posted

Yes,

 

I've tried that as well. It's parent form is not set to topmost either.

 

This is really getting me frustrated. For debugging purposes, Ii've even put a timer on the parent to fire every 2 seconds, and do form1.Hide() and form1.Show() to hide/show the form i can't focus.

 

The form shows up, goes away, shows up, goes away, etc. However, every time it shows up. It doesn't have focus. Putting in .BringToFront, .Activate(), and .Focus() after each .Show() still doesn't give it focus.

 

I've tried ShowDialog(). Same thing, form's on top, no focus.

Posted

some additional information:

 

the parent form doesn't always show. If the circumstances are correct, the parent form doesn't show (i.e. stays hidden), and the child form is shown.

 

The child form is used to login to the server side of my application.

 

The parent form is a debugging form for the client/server applicatoin i'm working on. If in 'debug' mode for my applicatoin, all the communication between the client/server is shown on the parent form.

 

The 'showing' of the child form occurs through a series of methods started in the form_load event of the parent form. I thought that this may be the problem, that's why i put the timer on there for testing to show the child form after the parent's form_load was finished.

Posted

It's a little hard to help when one cannot see what you are doing, even from a conceptual perspective. Under normal circumstances, you should not have a problem ...

 

 

Can't you try to "generalize" your code and then post it?

 

I open tons of form on top of other forms and never had a problem. Take a close look at the stuff you do in this form load ...

IS

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...