Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

VS 2010 KeyPress event on a DataGridView not firing

$
0
0
All I'm trying to do is to validate what the user types into particular cells but I'm not able to trap the KeyDown and KeyPress events to begin doing this (if indeed that's the best way).

In trying to solve this I came across an old thread here - http://www.vbforums.com/showthread.p...ent-Not-Fired" which seems to address the same problem. What Jmcilhinney says is :
Quote:

If you're editing a cell in a DataGridView then the control in which you're editing the value has focus. You'd have to handle the events of that control. You can get a reference to it through the EditingControl property of the grid. Note that the editing control may change as you edit different cells so you need to track it so you know which control to handle the events of. There are various events of the DataGridView that will help you do this, e.g. EditingControlShowing.
Well, for the person whose problem this was addressed to, this was enough to solve their problem. I, however, have no idea how to use this advice.

Could someone please enlighten me further?

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>