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