Home All Groups Group Topic Archive Search About

DataGridView GotFocus

Author
20 Jan 2006 10:35 PM
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

Author
21 Jan 2006 2:33 AM
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
---------------
Show quote
"Nathan Franklin" <nat***@tsn.cc> wrote in message
news:dqrojv$67i$1@news-02.connect.com.au...
>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
>

AddThis Social Bookmark Button