>Hi All,
>
>I have a form with a grid, lots of textboxes, and some buttons. In one button, if the main code there is not to be run because of something wrong with data, I want the focus to go back to the grid, highlighting the selected record. But nothing I do seems to move the focus off the button.
>
>Here is the ending code I have under the button at the moment:
>
> THISFORM.setbuttons()
> KEYBOARD '{TAB}'
> KEYBOARD '{TAB}'
> THISFORM.REFRESH()
>
>
>setbuttons() just enables and disables the buttons as needed.
>I have tried:
>
> THISFORM.setbuttons()
> THISFORM.grid1.setfocus()
> THISFORM.REFRESH()
>
>but that does not put the focus where I want it.
>
>TIA
Hi Beth,
Have you tried to check what is going on right after grid1.SetFocus()? From where do you call your code?
If it's not broken, fix it until it is.
My Blog