Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Refresh

This method updates an object. It’s the VFP equivalent of FoxPro 2.x’s SHOW GET and SHOW GETS commands.

Usage

oObject.Refresh( [ lUpdateSourceControl ] )

When a record pointer moves or you recalculate a value, you usually want to update the display right away. That’s what Refresh is for. (Draw simply redraws what was already displayed.)

Refresh is also a method of the Project object, letting you refresh the visual display of the Project Manager after making changes. This is equivalent to selecting Refresh from the Project menu, or pressing F5 when the project has the focus. This isn’t useful for solo developers, but is handy in situations where one person might add to a class library and another wants to see the changes.

The optional parameter applies to projects under source code control. It determines whether or not the source control status of each file in the project is updated at the same time as the display is refreshed. Since your teammates can change the status of files you might be interested in, this method call gives you an easy way to see what has changed.

Refresh drills down into contained objects except for Pages. Only the top page (the visible one) of a page frame is refreshed by calling the page frame's Refresh. Microsoft's stated reason is performance. Given the speed of form refreshes generally, it seems like a good choice to us. You can refresh an individual page in its Activate event.

Although Refresh looks at the data source for the control, it doesn’t update the contents of lists and combos. Use the Requery method for that.

Example

* A simplified version of the Click code for a Next button is:
SKIP
ThisForm.Refresh()

See Also

Activate, Draw, Project, Requery