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:
Private Sub Command5_Click() Dim strFile() As String, strPath As String Dim n As Long, nCount As Long On Error Resume Next With CommonDialog1 .Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNLongNames .MaxFileSize = 32767 .CancelError = True .InitDir = "C:\Program Files\mgamerz\XML PLAYER\my_mp3s" .DialogTitle = "Select File To Delete" .ShowOpen If Err.Number <> cdlCancel Then strFile = Split(.FileName, vbNullChar) nCount = UBound(strFile) If nCount = 0 Then 'Only one file is selected so split up the path and the filename ReDim strFile(1) strFile(0) = Left$(.FileName, InStrRev(.FileName, "\")) strFile(1) = Mid$(.FileName, InStrRev(.FileName, "\") + 1) nCount = 1 End If strPath = strFile(0) If Right$(strPath, 1) <> "\" Then strPath = strPath & "\" End If For n = 1 To nCount Kill strPath & strFile(n) Next End If End With End Sub




Reply With Quote