|
-
Apr 29th, 2010, 10:49 PM
#1
Thread Starter
PowerPoster
bad file name error #52
This function gathers all the drive letters on a USB drive. It is reporting a bad File Name at Line 90 anyone know why ?
Code:
Function BackUpBidFoldersDrive() As String
Dim UsbDriverLetters() As String
Dim DriveLetterToUse As String
Dim counter As Integer
Dim i As Integer
Dim UsbDriveLetter As String
Dim TmpDriveLetter As String
Dim CdFlashDriveLetter As String
Dim freespace As Double 'Long
Dim MostSpace As Double
30 On Error GoTo e
40 counter = 0
50 For i = 65 To 90
60 If DriveType(Chr$(i)) = "removeable" Then
70 If Chr$(i) <> "A" Then 'A shows as removal also
counter = counter + 1
80 TmpDriveLetter = Chr$(i)
90 ReDim Preserve UsbDriverLetters(counter + 1) 'error here
UsbDriverLetters(counter) = Chr$(i) & ":\"
End If
End If
Next i
Last edited by isnoend07; Apr 30th, 2010 at 11:45 AM.
Reason: unmarked resolved
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Apr 30th, 2010, 01:47 AM
#2
Addicted Member
Re: bad file name error #52
No idea cuz i dont see anything wrong. Have you tried restarting the IDE?
vb Code:
Option Explicit Private Declare Function GetLogicalDriveStrings Lib "kernel32.dll" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Private Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long Private Const DRIVE_REMOVABLE As Long = 2 Private Sub Form_Load() Dim szDrivesBuff As String, lRet As Long, szDrives() As String, nIndx As Integer, nDrvIndex As Integer, szRemDrives() As String nDrvIndex = 0 szDrivesBuff = Space(255) lRet = GetLogicalDriveStrings(Len(szDrivesBuff), szDrivesBuff) szDrivesBuff = Left(szDrivesBuff, lRet) szDrives() = Split(szDrivesBuff, Chr(0)) For nIndx = 0 To UBound(szDrives()) Step 1 If (GetDriveType(szDrives(nIndx)) = DRIVE_REMOVABLE) Then If (szDrives(nIndx) <> "A:\") Then ReDim Preserve szRemDrives(nDrvIndex) szRemDrives(nDrvIndex) = szDrives(nIndx) nDrvIndex = nDrvIndex + 1 End If End If Next nIndx End Sub
-
Apr 30th, 2010, 02:17 AM
#3
Thread Starter
PowerPoster
Re: bad file name error #52
Found it. It was in my drive type
replaced this
sDriveName = GetDriveType(sDrive & ":\")
with
sDriveName = sDrive & ":\"
This was incorrect as a solutation
How do i unresolve this question ?
Last edited by isnoend07; Apr 30th, 2010 at 11:30 AM.
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Apr 30th, 2010, 11:50 AM
#4
Thread Starter
PowerPoster
Re: bad file name error #52
Just noticed that the function has no line number past 90, but that does not solve the problem, the erorr still happens just not on that line
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|