|
-
Mar 15th, 2018, 01:55 AM
#8
Re: DataGridView Events
A DataGridView contains no child controls by default. When you start editing a cell, an editing control is created and embedded in the cell. That is why you stop seeing events raised by the grid while you're editing: it's the editing control that is raising events. When the editing control is created, the Value of the cell is assigned to the appropriate property of the control, e.g. the Text of a TextBox. When the editing session ends, the control property is assigned back to the Value property of the cell. That's why you don't see a CellValueChanged event from the grid until you end the editing session, which is usually done by navigating to a different cell.
What you can do is handle the EditingControlShowing event of the grid to get access to the editing control. You can then attach the appropriate event handlers to it. For instance, if you need to process keyboard input when editing a text box cell, you can attach handlers for KeyDown and/or KeyUp and/or KeyPress of the TextBox editing control. You can then handle the CellEndEdit event of the grid to detach those event handlers.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|