How find e.Keychar values 
Author Message
 How find e.Keychar values

I have code like the following:

Quote:
>if e.keychar = vbcr  then

I know that vbcr refers to the enter key.  I suppose that there are other
keys that start with vb.  I wonder if there is a vbIns or vbInsert.  How or
where can I find a listing of the different representations for vbxx keys?


Mon, 19 Sep 2005 06:44:17 GMT  
 How find e.Keychar values
Hi, try not to use the vb prefix keys, type Keys. and see what comes up in
the list.

--
==============================================
Happy to Help,
Tom Spink

http://dotnetx.betasafe.com > .NET code (soon)

One Day,

Quote:
> I have code like the following:

> >if e.keychar = vbcr  then

> I know that vbcr refers to the enter key.  I suppose that there are other
> keys that start with vb.  I wonder if there is a vbIns or vbInsert.  How
or
> where can I find a listing of the different representations for vbxx keys?



Mon, 19 Sep 2005 06:57:43 GMT  
 How find e.Keychar values
I see that if I type Keys. in my code editor I get a list of keys.  Very
helpful.  But that doesn't tell me how to use it.  I tried

If e.KeyChar = Insert then

If e.KeyChar = Keys.Insert then

But, of course, these don't work.

What am I missing?

Thanx in advance.



Mon, 19 Sep 2005 07:27:15 GMT  
 How find e.Keychar values

Quote:
> I have code like the following:

> >if e.keychar = vbcr  then

> I know that vbcr refers to the enter key.  I suppose that there
> are other keys that start with vb.  I wonder if there is a vbIns
> or vbInsert.  How or where can I find a listing of the different
> representations for vbxx keys?

There is no list because keychar doesn't return a key but it returns a char.
You'll see the difference when you press <Enter> or Ctrl+M. Both produce the
same char but are different keys.

To find the definition of vbCr, right click on the word and select "go to
definition". You'll see other constants but they are a general constants,
not only chars.

The <Insert> key doesn't produce a char, so there's no "insert char". To
catch keys instead of chars, handle the keydown or keyup events. E.keycode
returns the keycode. It's an Enum and the values are listed after typing the
"=" sign.

Armin



Mon, 19 Sep 2005 07:17:28 GMT  
 How find e.Keychar values
Hi, Woody

The following worked for me:

   Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)  _
          Handles TextBox1.KeyDown
      Debug.WriteLine("Keydown " + e.KeyValue.ToString)
      If e.KeyCode = Keys.Insert Then
         Debug.WriteLine("Keys.Insert detected")
      End If
   End Sub

Which keys are you interested in intercepting?  You can intercept most keys
in the KeyDown event, but some get grabbed at the form level.  For those
you need to use stronger methods.  Take a look at the following article

320583 HOW TO: Trap Keystrokes in .NET Controls by Using Visual Basic .NET
http://support.microsoft.com/?id=320583

HTH,

John Eikanger
Microsoft Visual Basic Team

This posting is provided AS IS with no warranties, and confers no rights.
(c) 2003 Microsoft Corporation.  All rights reserved.
--------------------



| Subject: Re: How find e.Keychar values
| Date: Wed, 2 Apr 2003 15:27:15 -0800
| Lines: 16
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| I see that if I type Keys. in my code editor I get a list of keys.  Very
| helpful.  But that doesn't tell me how to use it.  I tried
|
| If e.KeyChar = Insert then
|
| If e.KeyChar = Keys.Insert then
|
| But, of course, these don't work.
|
| What am I missing?
|
|
| Thanx in advance.



Tue, 20 Sep 2005 02:57:50 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Moving from VB6 - keypress/keychar function

2. Finding the number value of a hex value

3. Finding the value of the field used as prmary key

4. Finding the value of a global variable in another dbase

5. Finding the maximum values in a series

6. Finding values in a Table with Public Function?

7. find the top 8 values in recordset, done in code

8. Finding Value of senders email address

9. Find values

10. Finding Value in Excel Range

11. finding kth smallest value in an array

12. test the return value of aFolder.items.find(filter) method

 

 
Powered by phpBB® Forum Software