Hi again,

I have a directory that contains files and I wish to allow the user to delete them but would it be possible to display a message while the files are bieng deleted because otherwise it looks as if my program has locked up.

this is the code I'm using for deleting files. Also when the button is clicked to browse to the folder it doesnt always select the correct on. i.e if I have been in another folder it goes straight to that one. any suggestions.

Thanks
R

VB Code:
  1. Private Sub Command5_Click()
  2.  
  3. Dim strFile() As String, strPath As String
  4.     Dim n As Long, nCount As Long
  5.     On Error Resume Next
  6.     With CommonDialog1
  7.    
  8.         .Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNLongNames
  9.         .MaxFileSize = 32767
  10.         .CancelError = True
  11.         .InitDir = "C:\Program Files\mgamerz\XML PLAYER\my_mp3s"
  12.         .DialogTitle = "Select File To Delete"
  13.                                                              
  14.        .ShowOpen
  15.         If Err.Number <> cdlCancel Then
  16.             strFile = Split(.FileName, vbNullChar)
  17.             nCount = UBound(strFile)
  18.             If nCount = 0 Then
  19.                 'Only one file is selected so split up the path and the filename
  20.                 ReDim strFile(1)
  21.                 strFile(0) = Left$(.FileName, InStrRev(.FileName, "\"))
  22.                 strFile(1) = Mid$(.FileName, InStrRev(.FileName, "\") + 1)
  23.                 nCount = 1
  24.             End If
  25.             strPath = strFile(0)
  26.             If Right$(strPath, 1) <> "\" Then
  27.                 strPath = strPath & "\"
  28.             End If
  29.             For n = 1 To nCount
  30.                     Kill strPath & strFile(n)
  31.            
  32.             Next
  33.         End If
  34.     End With
  35. End Sub