Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF C#4.0
hello guys ,
i have a problem i am using Key Down Event of the form and i can be fired only when the form Loaded but when i give the focus to an element of the form Like Text box can not fire this event again because focus can not be backed to the Form again and if i clicked by mouse any where in the form it do nothing and still the text box have the focus i want to when i click any where in the form the form focused once again and any other control must lost focus can any one help me in doing that ?
thanks in advanced
Posted 20-Sep-12 10:35am
yayaNasr1.3K
Comments
yayaNasr at 20-Sep-12 17:17pm
   
because i use bar code reader when i try to raed the code and during the text box or any other element focused the code typed in the text box and also the Key pressed is Fired and i did not want to type nothing in the text box .
Sergey Alexandrovich Kryukov at 20-Sep-12 17:12pm
   
I agree with Meysam Tolouee.
Besides, you should understand that the focus is a keyboard focus, rather a property of a control.
For a window (not "Form", Window), you can talk about activation. When you activate a window, the control which was to has the focus will get it again.
--SA
yayaNasr at 20-Sep-12 17:17pm
   
because i use bar code reader when i try to raed the code and during the text box or any other element focused the code typed in the text box and also the Key pressed is Fired and i did not want to type nothing in the text box .
Sergey Alexandrovich Kryukov at 20-Sep-12 17:34pm
   
???
You are really hard to understand...
--SA
Rickin Kane at 20-Sep-12 22:32pm
   
What's so hard to understand , its simple , what i understood so far is he is working on barcode reader and something should happen and something should not happening and something will happen and something has happen , thats all , hahaha
sushil.mate at 21-Sep-12 0:09am
   
:D
Sergey Alexandrovich Kryukov at 21-Sep-12 0:43am
   
:-)
Wes Aday at 20-Sep-12 17:20pm
   
What you are doing/saying makes no sense. When I create a key down event for the window and set focus to a textbox the key down event fires when I type anything in the textbox.
yayaNasr at 28-Sep-12 16:40pm
   
oh yes sorry

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It is the default behavour of the event and controls where it get fired, please override the events if you want any specific operation on event fired.. if still any query then please be specific again that what you done. what you want and what you are getting right now... thanks..
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 324
1 Maciej Los 239
2 Sergey Alexandrovich Kryukov 182
3 CPallini 120
4 Richard MacCutchan 120
0 OriginalGriff 5,474
1 Sergey Alexandrovich Kryukov 4,713
2 Peter Leow 2,944
3 DamithSL 2,465
4 Maciej Los 2,434


Advertise | Privacy | Mobile
Web03 | 2.8.140718.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid