free web hosting | website hosting | Business Web Hosting | Free Website Submission | shopping cart | Promoter Online | php hosting
affordable web hosting Pets web page hosting web hosting website hosting web hosting service web hosting best web hosting
 

Main

Aplications

Games

User Controls

Class

Code Snipets

Tips

Add-Ins

Other stuff

Contact

Gest Book

About

The final Code

The ValidateConsumedItems function will check if each item that is stored in the collection exists, if it does not exist it will be removed from the collection.
 


'--------------------------------------------------------------------------------------- 
' Procedure : ValidateConsumedItems 
' DateTime  : 01-04-2003 17:45 
' Author    : 
' Purpose   : validates the existence in disk of the items in the collection 
'--------------------------------------------------------------------------------------- 
' 
Public Function ValidateConsumedItems()
Dim tempobj As Variant


For Each tempobj In ConsumedItems
 If FileOrFolderExists(tempobj) = False Then
   ConsumedItems.Remove ConsumedItems.Item(tempobj)
 End If
Next

End Function

The function FileOrFolderExists checks if a file or folder exits in disk.



'---------------------------------------------------------------------------------------

' Procedure : FileOrFolderExists
' DateTime  : 01-04-2003 17:45
' Author    :
' Purpose   : checks if a item exists on disk
'---------------------------------------------------------------------------------------

'
Private Function FileOrFolderExists(Filename) As Boolean

If Dir(Filename, vbNormal Or vbReadOnly Or vbHidden Or _
    vbSystem Or vbArchive Or vbDirectory) = "" Then
        FileOrFolderExists = False
Else

        FileOrFolderExists = True
End If

End Function

 


In the class initialize event we create the collection witch will hold the file or folder
list and in the terminate event we destroy the collection.


Private Sub Class_Initialize()
    Set ConsumedItems = New Collection
End Sub

Private Sub Class_Terminate()
    Set ConsumedItems = Nothing
End Sub

FileFolderCons class ] Lets Begin ] [ The final Code ] How to use the class ]
 

Links:

Page Last Updated: 02-07-2003