local loMinControl loMinControl = .null. For each loControl in ThisForm.Controls if not if pemstatus(locontrol,'controlcount',5) if pemstatus(locontrol,'setfocus',5) and locontrol.enabled if isnull(loMinControl) or loControl.tabindex < lomincontrol.tabindex lomincontrol = locontrol endif endif endif endfor note: loMincontrol is a hanging reference until end of setfocus if not isnull(loMincontrol) loMinControl.setfocus() endif loMinControl = .null.>>>>I did force a SetFocus() on one of my control whenever I call the Refresh() method. This solves the problem.
>local loMinControl >loMinControl = .null. >for each loControl in ThisForm.Controls > if isnull(loMinControl) > if upper(loControl.BaseClass) <> "GRID" and pemstatus(loControl, 'SetFocus', 5) and loControl.Enabled > loMinControl = loControl > endif > loop > endif > if upper(loControl.BaseClass) <> "GRID" and pemstatus(loControl, 'SetFocus', 5) and loControl.Enabled > if loControl.TabIndex < loMinControl.TabIndex > loMinControl = loControl > endif > endif >endfor >if not isnull(loMinControl) > loMinControl.SetFocus() >endif >