473,396 Members | 1,918 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,396 software developers and data experts.

KeyDown,Up (F1,F2,F3...), please help me

How I can create an Sub Form_KeyDown, I need setup the F2, F2, or Insert not
the TextBox or Controls Event, I need create an Form_KeyDown
I was using this but dosent work.

Please help me
Private Sub Form_KeyDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

MsgBox(e.KeyCode)

End Sub

Nov 20 '05 #1
11 4082
Hi Juan,

You need to set the KeyPreview property of the Form to True.

Regards,
Fergus
Nov 20 '05 #2
* "Fergus Cooney" <fi****@post.com> scripsit:
You need to set the KeyPreview property of the Form to True.


_How_ to do that?

SCNR

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #3
* "JuanCarlos Gomez" <jc*********@hotmail.com> scripsit:
How I can create an Sub Form_KeyDown, I need setup the F2, F2, or Insert not
the TextBox or Controls Event, I need create an Form_KeyDown
I was using this but dosent work.
I am nort sure, but maybe you want to set the form's 'KeyPreview'
property to 'True'.
Please help me
Private Sub Form_KeyDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

MsgBox(e.KeyCode)
\\\
If e.KeyCode = Keys.F4 Then
...
End If
///
End Sub


--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #4
Herfried, I find you most unfunny.

SCNR ?
Please <do> R

The fact that you see any place for humour is just an indication of your insensitivity. I don't want to see more
indications of this Herfried, it has become <so clear> to me by now.

I've asked you before.
Please stop posting to me.
Now I've asked you again.

When will you 'get' this message ?
When will you understand this ?

Verstehst du?

Your silence will be taken as an affirmative answer.
Nov 20 '05 #5
you just cant stop letting it bug you can you.....
"Fergus Cooney" <fi****@post.com> wrote in message news:u$*************@tk2msftngp13.phx.gbl...
Herfried, I find you most unfunny.

SCNR ?
Please <do> R

The fact that you see any place for humour is just an indication of your insensitivity. I don't want to see more indications of this Herfried, it has become <so clear> to me by now.

I've asked you before.
Please stop posting to me.
Now I've asked you again.

When will you 'get' this message ?
When will you understand this ?

Verstehst du?

Your silence will be taken as an affirmative answer.

Nov 20 '05 #6
Hi Rick,

Imagine a big pot of porridge. First you turn the heat off. Then you pick it up in your bare hands. No, maybe not. You
let it cool down. It's a big pot - it takes time. Then you can pick it up. But you can't stick your hand in and start
stirring. So you let it cool way down. Then you can use it like putty if you like.

You're right Rick, it bugs me a great deal at the moment. (We should say 'he' but I know what you mean).

It's not exactly hard is it? I ask hin to steer clear. He steers clear. Everything cools - in its time. I ask him to
steer clear. He pokes and prods. The fire flares up again.

Regards,
Fergus
Nov 20 '05 #7
* "Rick Mogstad" <ri**@NOSPAM.computetosuit.com> scripsit:
you just cant stop letting it bug you can you.....


Don't feed the trolls.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #8
Cor
Herfried,

I don't see the sence of this message, but the less you can do with this
kind of messages is put OT before it. I don't believe Juan Carlos Gomez is
intrested in it.

Cor
Nov 20 '05 #9
Cor
Herfried,

I did above give you an example without and here with, do you see, much
nicer

:-))

Cor
Nov 20 '05 #10
* "Cor" <no*@non.com> scripsit:
I don't see the sence of this message, but the less you can do with this
kind of messages is put OT before it. I don't believe Juan Carlos Gomez is
intrested in it.


Sorry, I forgot to add that...

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #11
Hi Juan,

I've just seen your reply which went to my email address:

|| Thanks for your help Fergus, but I have already this on
|| KeyPreview=True.
||
|| I have an MDIChild Form, but when I am trying to set up or
|| debug fail, ie. never pass on the SUb Form_KeyDown(....)
|| Do you have some idea about my mistake ?

Are you setting KeyPreview = True on the main Form or on the MDI
chld? To trap keys on a Form, it must be the KeyPreview of <that> Form
which is set. If that's not the case, it might be useful for you to post some of
your code.

Regards,
Fergus

--
(Please ignore this - there's a feud going on)
==================================================
Quote of the day
Herfried:
I don't need/want human interaction.
==================================================
Nov 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: Andrew DeFaria | last post by:
I thought this would be fairly straight forward but apparently it's not. Given the following html file: <!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> <html> <head>...
3
by: bardo | last post by:
I have a Datagrid that is inside a panel. I want to use the keyDown event to reconize the arrow keys. But I have no luck at all. The problem is that the keydown event won't fire at all, unless I...
3
by: Peter S | last post by:
I have function : System::Void Form1_KeyDown(Object* sender, KeyEventArgs* e) but this: this->KeyDown += new KeyEventHandler(this, Form1_KeyDown); doesnt work.. how I can change it to run?...
16
by: Merlin | last post by:
I have created a users control with a text box and button on it, what I want to do is override the usercontrol Keydown events with that of the Text box. What is the correct syntax to accomplish...
2
by: RS | last post by:
I would like to interface with the Win32 API and I need the HWND handle to Form1 ( I'm assuming it is Me.Handle) and I need Form1 to respond to keyboard input. Using the information from a previous...
12
by: Sven | last post by:
I only know the keydown-event in VB 6, there it is like this: Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then XXXXXXXXXXX End If How can I do this in...
4
by: ShaneO | last post by:
I would like to handle the KeyUp & KeyDown events in the same event handler but can't find how to determine which event was fired - Private Sub ListBox1_KeyUp(ByVal sender As Object, ByVal e As...
9
by: pamelafluente | last post by:
I have found on the web a post with this useful way to convert (if possible) a ScanCode to Ascii. This is remarkably useful to filter keys under KeyDown/up event. My problem is that I am not...
4
by: velasquez.m | last post by:
i'm working with visual studio 2005 and have a solution with 16 projects in it. this specific application has a base form with other forms added to it at any area of the application that the...
3
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.