Catch click to close form

pettrer

Well-known member
Joined
Sep 5, 2008
Messages
92
Programming Experience
10+
Hi all,

I have a stupid problem. I have a datagridview with both textcells and comboboxcells in it. If I click a textcell and then click the form's Close button, the form closes alright. But if I click a comboboxcell and then click the Close button (or any button for that matter), the first click only deselects the combobox cell. This is causing me some trouble. Does anyone know how to catch the first click so that I can hook it up to the Close button?

Edit: Upon further investigation, this seems to be the case: If I have selected a combobox outside the datagridview, the Close button works fine. However, if I have selected a combobox inside the datagridview (ie a comboboxcell) the first click only dselects the cell (the CmdClose event won't fire). The Escape key still works correctly though (that is, it fires on the first hit, even if I have selected a combobox in the datagridview).

All suggestions are highly welcome!

All the best,

/Pettrer
 
Last edited:
Back
Top