Error message coming up 3 times
I have a loop that adds rows to a listview. If while loading we run out of memory i have an error trap that displays an appropriate message. I also have an Exit function statement following it but the code refuses to exit at that point, insteda the code loops round various areas in the same function another twice before finally exiting and in doing so causes the errortrap to be called an extra twice. Why is it doing this and how d i get it to exit the function immediately after i get the error? Thanks
Re: Error message coming up 3 times
Quote:
Originally posted by Blobby
I have a loop that adds rows to a listview. If while loading we run out of memory i have an error trap that displays an appropriate message. I also have an Exit function statement following it but the code refuses to exit at that point, insteda the code loops round various areas in the same function another twice before finally exiting and in doing so causes the errortrap to be called an extra twice. Why is it doing this and how d i get it to exit the function immediately after i get the error? Thanks
Thats why your code does not exit the function cause you are calling it recursively .....
VB Code:
If fName = "." Or fName = ".." Then
'do nothing
Else
If (WFD.dwFileAttributes And vbDirectory) = vbDirectory Then
If Right(UCase(fPathName), 8) = "RECYCLED" And Len(fPath) = 3 Then 'We dont want the recycle bin so ignore it
'do nothing
ElseIf Level > 0 Then
If CancelSearch = False Then
Status = "Scanning " & fPathName
End If
[b]LoadFiles fPathName, NamePattern, Level - 1[/b]
End If
End If
End If