473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Key Down event is not working

I've created a form in which to add an event to open a chm file on press of F1 i've included a code on keydown event of form but it is not getting fired even i've made the keypreviev property true.....

Expand|Select|Wrap|Line Numbers
  1. Private Sub frmFacilityDetails_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
  2.         Try
  3.             If e.KeyCode = Keys.F1 Then
  4.                 Globals.ShowHelpMe(Me)
  5.             End If
  6.         Catch ex As Exception
  7.             MsgBox(ex.Message, MsgBoxStyle.Information + MsgBoxStyle.OkOnly, Me.Text)
  8.         End Try
  9.     End Sub
  10.  
Jul 30 '08 #1
9 1908
IanWright
179 100+
I've created a form in which to add an event to open a chm file on press of F1 i've included a code on keydown event of form but it is not getting fired even i've made the keypreviev property true.....


Private Sub frmFacilityDetails_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Try
If e.KeyCode = Keys.F1 Then
Globals.ShowHelpMe(Me)
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information + MsgBoxStyle.OkOnly, Me.Text)
End Try
End Sub
Well I don't use VB, but have you checked that you have added the event handler to the actual form?

Expand|Select|Wrap|Line Numbers
  1. frmFacilityDetails.KeyDown += new KeyEventHandler(frmFacilityDetails.frmFacilityDetails);
or the VB equivalent.
Jul 30 '08 #2
Well I don't use VB, but have you checked that you have added the event handler to the actual form?

Expand|Select|Wrap|Line Numbers
  1. frmFacilityDetails.KeyDown += new KeyEventHandler(frmFacilityDetails.frmFacilityDetails);
or the VB equivalent.

Yes i've added the handler 'Handles MyBase.KeyDown' ... this way it is handled in VB.net... thanks but any other suggestion...
Jul 30 '08 #3
MrMancunian
569 Expert 512MB
I think the problem is

Globals.ShowHelpMe(Me)

Try replacing it with Msgbox("Test") and see if that works. If not, please post the version of VS you're working with.

Steven
Jul 30 '08 #4
I think the problem is

Globals.ShowHelpMe(Me)

Try replacing it with Msgbox("Test") and see if that works. If not, please post the version of VS you're working with.

Steven
Globals is a class i've defined to incorporate all global functions... so this is not the problem i think... well this code is working fine with few other forms but in few not........
Any Suggestions...!
Jul 30 '08 #5
Plater
7,872 Expert 4TB
I am thinking that something other then the Form object is getting the focus and taking the keydown events and not sharing them with the form.
Have to checked to see if that function receives any other keys?

I believe there is also some funkiness if you have F1 set as a neumonic anywhere on the form.
Jul 30 '08 #6
I am thinking that something other then the Form object is getting the focus and taking the keydown events and not sharing them with the form.
Have to checked to see if that function receives any other keys?

I believe there is also some funkiness if you have F1 set as a neumonic anywhere on the form.

as per the code i 've given only F1 key in the limelight & also didnt used it anywhere else.....
How can i check that focus is going where since debugger is also not activating any event .... and thus i m unable to trace it....
Jul 30 '08 #7
Plater
7,872 Expert 4TB
Hmm, have you tried handles Me.Keydown and not MyBase.KeyDown?
Jul 30 '08 #8
Hmm, have you tried handles Me.Keydown and not MyBase.KeyDown?

yes tried so but got the same result...No Response.....
Jul 30 '08 #9
Plater
7,872 Expert 4TB
What other controls are on the form? Maybe a textbox has the focus?
Jul 30 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
6
by: TPI | last post by:
I wrote application wich i working on IntPtr. Whole thing is using Marshal.ReadInt32 and Marshal.WriteInt32. And sometimes the application shuts down with out any wornings and exceptions. With...
5
by: Jeff S | last post by:
I'm creating a new Windows Forms MDI application... How can I add cause the application to shut itself down after a period of ? I did this in an old COM/VB6 application and I had to have code...
4
by: Enrika | last post by:
Greetings! I'm working on a CSS drop-down menu, which, to my surprise, is actually working, more-or-less, in both IE *and* Firefox (and Netscape). But there are two changes that I want to make that...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
4
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
1
by: JDeats | last post by:
If you create a new C# Windows Application project in Visual Studio.NET 2003 or 2005 and proceed to. 1. Make default form size 800x600 2. Drop a CheckBoxList control and dock it to the left 3....
22
by: schneider | last post by:
I need to hook the system mouse down event. I'm trying to replicate how a context menu hides when the mouse clicks outside of the control. Thanks, Schneider
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.