473,796 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't Catch KeyUp Event

I'm trying to catch the KeyUp event in textbox of a DataGrid. I'm
picking up the keydown and keypress events ok, but not keyup. Can
anyone see what is wrong with this code. I been fighting with this
for way too long.

Thanks a ton,
Gene H.

=============== ===

Option Strict On
Option Explicit On

Imports Microsoft.Visua lBasic
Imports System
Imports System.Drawing
Imports System.Windows. Forms

Public Class DataGridNoEditC olumn
Inherits DataGridTextBox Column

Private mDGTBCNotifyShi ftKey As delegateDGTBCNo tifyShiftKey

Public Sub New()
MyBase.New()
End Sub

Public Sub New(ByVal DGTBCNotifyShif tKey As
delegateDGTBCNo tifyShiftKey)
MyBase.New()
mDGTBCNotifyShi ftKey = DGTBCNotifyShif tKey
AddHandler Me.TextBox.KeyD own, AddressOf HandleKeyDown
AddHandler Me.TextBox.KeyU p, AddressOf HandleKeyUp
AddHandler Me.TextBox.KeyP ress, AddressOf HandleKeyPress
End Sub

Private Sub HandleKeyDown(B yVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs)
Console.WriteLi ne("caught " & e.KeyData & " in keydown")
If e.Shift Then
Console.WriteLi ne("caught a shift in keydown")
mDGTBCNotifyShi ftKey(True)
End If
End Sub

Private Sub HandleKeyUp(ByV al sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs)
Console.WriteLi ne("caught " & e.KeyData & " in keyup")
If e.Shift Then
Console.WriteLi ne("caught a shift in keyup")
mDGTBCNotifyShi ftKey(False)
End If
End Sub

Private Sub HandleKeyPress( ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs)
Console.WriteLi ne("caught " & e.KeyChar.ToStr ing & " in
keypress")
End Sub

Protected Overloads Overrides Sub Edit(ByVal source As
CurrencyManager , _
ByVal rowNum As Integer, ByVal bounds As Rectangle, _
ByVal readOnly1 As Boolean, ByVal instantText As String, _
ByVal cellIsVisible As Boolean)
'do not allow the unbound cell to become active
If (Me.MappingName = "Name") Then
MyBase.Edit(sou rce, rowNum, bounds, readOnly1,
instantText, cellIsVisible)
End If
End Sub
End Class
Nov 20 '05 #1
0 1420

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

Similar topics

3
2088
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender, System.EventArgs e) { MessageBox.Show("keyboard button pressed!");
3
10668
by: JPSutor | last post by:
I currently have this code in my kepup event of a text box. It works except for the fact that if the number 25,000 or any number is put in then the user arrows to the left of the third zero and tries to replace the number 0 with a 4, this is the result 25,004 Here is my code. Any help would be appreciated. public static void KeyStroke_FormatNumericText(string number,TextBox
1
1728
by: graeme g | last post by:
hi is it possible to catch a keyup event in a panel? as i don't seem to be able to do it... i've even created a message handler for WM_KEYUP in the WndProc procedure but nothing works :-( any help appreciated...
15
4058
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE CALLING FORM! This is very bad for me, because in my application, Form1 responds to an ENTER keypress by calling Form2. If the user closes Form2 via an ENTER, then Form1 just reopens it again, kind of trapping the user in Form2 (they can still close...
2
2355
by: Adam J. Schaff | last post by:
I have recently noticed an unwanted behavior that I do not know how to get rid of. To Recreate Problem: Windows Forms App with 2 forms. Form 1 has nothing on it and this code underneath: Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp If e.KeyCode = Keys.Return Then
4
6981
by: **Developer** | last post by:
I have a usercontrol that contains the following. To my surprise the form containing this control get KeyUp events. Help says that for KeyPress setting e.Handled = True suppresses KeyPress events but say very little about KeyUp. What does setting to Handled do?
4
7131
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 System.Windows.Forms.KeyEventArgs) _ Handles ListBox1.KeyUp, ListBox1.KeyDown If e.KeyValue = Keys.PageDown Or e.KeyValue = Keys.PageUp Or e.KeyValue = Keys.End Or e.KeyValue = Keys.Home Then
1
6206
by: Frank O'Hara | last post by:
I think I'm losing my mind, granted it is kind of late here so... I'm trying to do some simple validation on the client as keys are pressed. The validation routine works well enough however I can't seem to cancel the event should the validation fail. Well more accurately, I can't cancel the keyup event. When I hook the following routine to the keydown event it works well and an invalidation cancels the event. I'm hooking the...
1
4405
by: jayturley | last post by:
I have a web page with the following items on it: <label for="commissionschedule"> Commission Schedule<br /> <span id="charCounter">1000 characters or less</span> </label> <textarea id="commissionschedule" rows="10" cols="40"></textarea> I'm using a standard javascript addEvent function and am attaching a keyup event to the textarea as follows:
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10174
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7548
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.