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

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.VisualBasic
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public Class DataGridNoEditColumn
Inherits DataGridTextBoxColumn

Private mDGTBCNotifyShiftKey As delegateDGTBCNotifyShiftKey

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

Public Sub New(ByVal DGTBCNotifyShiftKey As
delegateDGTBCNotifyShiftKey)
MyBase.New()
mDGTBCNotifyShiftKey = DGTBCNotifyShiftKey
AddHandler Me.TextBox.KeyDown, AddressOf HandleKeyDown
AddHandler Me.TextBox.KeyUp, AddressOf HandleKeyUp
AddHandler Me.TextBox.KeyPress, AddressOf HandleKeyPress
End Sub

Private Sub HandleKeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)
Console.WriteLine("caught " & e.KeyData & " in keydown")
If e.Shift Then
Console.WriteLine("caught a shift in keydown")
mDGTBCNotifyShiftKey(True)
End If
End Sub

Private Sub HandleKeyUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)
Console.WriteLine("caught " & e.KeyData & " in keyup")
If e.Shift Then
Console.WriteLine("caught a shift in keyup")
mDGTBCNotifyShiftKey(False)
End If
End Sub

Private Sub HandleKeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs)
Console.WriteLine("caught " & e.KeyChar.ToString & " 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(source, rowNum, bounds, readOnly1,
instantText, cellIsVisible)
End If
End Sub
End Class
Nov 20 '05 #1
0 1400

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

Similar topics

3
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...
3
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...
1
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 :-( ...
15
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...
2
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: ...
4
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...
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...
1
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...
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.