473,671 Members | 2,454 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 1413

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

Similar topics

3
2076
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
10660
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
1725
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
4036
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
2351
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
6968
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
7126
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
6193
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
4396
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
8402
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
8927
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...
0
8825
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8676
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
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
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
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
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.