Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 3rd, 2003, 04:11 PM
Authorized User
 
Join Date: Jul 2003
Location: Dallas, TX, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to yossarian Send a message via AIM to yossarian Send a message via MSN to yossarian Send a message via Yahoo to yossarian
Default Trapping the Shift key

I'm having trouble with trapping the Shift key in the KeyDown or KeyPress event of a combobox. I want to ignore the key. Any help or guidance is appreciated. Thanks in advance.
  #2 (permalink)  
Old July 6th, 2003, 02:00 PM
Authorized User
 
Join Date: Jul 2003
Location: Reading, Berkshire, United Kingdom.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alex_read
Default

For another time, each character on your keyboard has a corresponding ascii number value of the key - i.e. in ascii, the letter A is equivalent to 65, B to 66 etc.

Typing in msgbox keycode under the combobox_keypress event will give you the number of the key you're testing, which you can then place into an if statement to check against like this...
Code:
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode <> 32 Then
        MsgBox "The key " & Chr(KeyCode) & " was pressed!"
    End If
End Sub
  #3 (permalink)  
Old July 7th, 2003, 08:03 PM
Authorized User
 
Join Date: Jul 2003
Location: Dallas, TX, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to yossarian Send a message via AIM to yossarian Send a message via MSN to yossarian Send a message via Yahoo to yossarian
Default

I've got that part -- the keycode is 16 that I test. The problem is that even when setting the keycode to 0, it still doesn't disable the Shift key. Any Ideas?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable the [SHIFT Key] on Startup ru1 Access 4 September 22nd, 2007 09:27 PM
Help: Disable the "Shift Key" on macro Auto run ofAlexander Word VBA 1 June 24th, 2007 03:16 AM
shift from vb to c# noman77 .NET Framework 2.0 1 October 14th, 2004 08:15 AM
Shift + Enter OR Shift+Double-Click phungleon Access 2 May 20th, 2004 10:14 AM
Enable Shift Key to By Pass Macro! sampow Access 1 December 4th, 2003 07:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.