Visual Basic Reference

Refresh Method

See Also    Example    Applies To

Forces a complete repaint of a form or control.

Syntax

object.Refresh

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Use the Refresh method when you want to:

  • Completely display one form while another form loads.

  • Update the contents of a file-system list box, such as a FileListBox control.

  • Update the data structures of a Data control.

Refresh can't be used on MDI forms, but can be used on MDI child forms. You can't use Refresh on Menu or Timer controls.

Generally, painting a form or control is handled automatically while no events are occurring. However, there may be situations where you want the form or control updated immediately. For example, if you use a file list box, a directory list box, or a drive list box to show the current status of the directory structure, you can use Refresh to update the list whenever a change is made to the directory structure.

You can use the Refresh method on a Data control to open or reopen the database (if the DatabaseName, ReadOnly, Exclusive, or Connect property settings have changed) and rebuild the dynaset in the control's Recordset property.