PC Review


Reply
Thread Tools Rate Thread

Win Form never gets focus?!?

 
 
Fre
Guest
Posts: n/a
 
      12th Mar 2008
Hi all,

In my winform application, I want to check on certain moments if my
winform has focus. If so, some code will be executed. I noticed
however, that the winform never gets the focus, even when it clearly
has focus. How is that possible? What setting could I've messed with
that causes my winform never to get focus, even when activated?

void Form1_Activated(object sender, EventArgs e)
{
// always returns 'False' in my project (when I test
// in new project, it returns 'True' however!!)
Console.WriteLine("ACTIVATED & " + "this.Focused = " +
this.Focused);
}

Thanks in advance for your answers.

Frederik
 
Reply With Quote
 
 
 
 
Ravi Bhavnani
Guest
Posts: n/a
 
      18th Mar 2008
Try checking:

if (Form.ActiveForm.Equals (this))
...

instead of:

if (this.Focused)
...

/ravi

----------------------------
"Fre" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> In my winform application, I want to check on certain moments if my
> winform has focus. If so, some code will be executed. I noticed
> however, that the winform never gets the focus, even when it clearly
> has focus. How is that possible? What setting could I've messed with
> that causes my winform never to get focus, even when activated?
>
> void Form1_Activated(object sender, EventArgs e)
> {
> // always returns 'False' in my project (when I test
> // in new project, it returns 'True' however!!)
> Console.WriteLine("ACTIVATED & " + "this.Focused = " +
> this.Focused);
> }
>
> Thanks in advance for your answers.
>
> Frederik



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Never, never, never nivrip General Discussion 3 19th Jun 2009 01:23 AM
Password never gets saved in IE7.0 in Win XP Pro Rayees Windows XP General 3 10th Jan 2008 11:30 AM
Never never try installing XP Pro with Service Pack2 on a SCSI HDD ram_swarnam@hotmail.com Windows XP Help 4 23rd Sep 2006 02:11 AM
a FIX for IE crash on find, new page never loading, windows update never downloading Mike2 Windows XP Internet Explorer 1 29th Jan 2006 04:24 PM
Switch Users w/ one user account sent me into never never land Ed Windows XP Accessibility 0 15th Jun 2004 03:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:46 AM.