kasdoffe Posted February 19, 2004 Posted February 19, 2004 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! Quote
I Schobert Posted February 19, 2004 Posted February 19, 2004 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)... Quote IS
kasdoffe Posted February 19, 2004 Author Posted February 19, 2004 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. Quote
kasdoffe Posted February 19, 2004 Author Posted February 19, 2004 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. Quote
I Schobert Posted February 19, 2004 Posted February 19, 2004 Could you post the code you have in your main form's load event? Quote IS
kasdoffe Posted February 19, 2004 Author Posted February 19, 2004 I don't think i can legally. ;) Quote
I Schobert Posted February 19, 2004 Posted February 19, 2004 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 ... Quote IS
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.