DataGridView GotFocus

N

Nathan Franklin

I have a DataGridView on my windows form and I am trying to enable buttons
on a toolbar when the DataGridView's GotFocus is called and then disable
with LostFocus(). The problem is I can only get the GotFocus to fire when I
click onto the header columns... when I click into the cells of the
DataGridView, the LostFocus for the control is fired and my buttons
disable...

What am I doing wrong?

Thanks in advance.
Nathan
 
K

Ken Tucker [MVP]

Hi,

Try using the datagridviews mouseenter and mouseleave events
instead. When you edit a cell the cells textbox gets the focus from the
datagridview. The mouse leave event does not fire until the mouse is
outside of the grid.

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top