We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

which control had focus before toolbar button pressed

Hi. I was wondering what the best way would be to determine which grid (or any control type) on a windows form had the focus just prior to the user pressing a toolbar button. I''m trying to put a generic "Query Data" button on a toolbar, which will refresh the data of any data-bound control that has focus when the button was pressed. Thanks for your help. Ross.

2 Replies

SG Sean Greer July 28, 2005 11:48 PM UTC

Perhaps Form.ActiveControl is what you''re looking for? >Hi. > >I was wondering what the best way would be to determine which grid (or any control type) on a windows form had the focus just prior to the user pressing a toolbar button. > >I''m trying to put a generic "Query Data" button on a toolbar, which will refresh the data of any data-bound control that has focus when the button was pressed. > >Thanks for your help. > >Ross.


RP Ross Prestmo July 29, 2005 02:43 PM UTC

Thanks. Yeah that will do it. I thought that the toolbar button would get returned as the ActiveControl as soon as I pressed it, like a normal button control does. Lots to learn ... :)

Loader.
Up arrow icon