Visual Basic Reference
Refresh Method Example
This example uses the Refresh method to update a FileListBox control as test files are created. To try this example, paste the code into the Declarations section of a form with a FileListBox control named File1, and then run the example and click the form.
Private Sub Form_Click ()
' Declare variables.
Dim FilName, Msg as String, I as Integer
File1.Pattern = "TestFile.*" ' Set file pattern.
For I = 1 To 8 ' Do eight times.
FilName = "TESTFILE." & I
' Create empty file.
Open FilName For Output As FreeFile
File1.Refresh ' Refresh file list box.
Close ' Close file.
Next I
Msg = "Choose OK to remove the created test files."
MsgBox Msg ' Display message.
Kill "TESTFILE.*" ' Remove test files.
File1.Refresh ' Update file list box.
End Sub