Issue with code?
#1
I am writing a small sub to gather the available drives on a system (windows) and I am getting spurious items printed on to the console window.  There are no print statements so the screen should be blank
[Image: 1screen.jpg]



Code: (Select All)
Dim Shared Drive$
Dim Shared DrvErr
Dim Shared DriveName$(27)
Dim Shared DriveNum%

DECLARE SUB FindDrives ()       '*** Find which drives are on the PC ***

FindDrives
'For x% = 1 To DriveNum%
'    Print DriveName$(x%)
'Next x%
'End

DriveErr:
If Err = 68 Then ProgErr = 1
DrvErr = 1
Resume Next

End



Sub FindDrives
    DriveNum% = 0
    '*** Find what drives are present in the PC ***

    Erase DriveName$
    On Error GoTo DriveErr
    For Count = 65 To 90
        DrvErr = 0
        Drive$ = Chr$(Count) + ":\"
        Files Drive$
        If DrvErr = 0 Then
            DriveNum% = DriveNum% + 1
            DriveName$(DriveNum%) = Chr$(Count)
        End If
    Next Count

End Sub


When using $Debug to watch execution, I get program crashes and windows messages that a problem has caused the program to stop working correctly. 

Not sure what is happening here, but it looks like a memory issue.
Reply


Messages In This Thread
Issue with code? - by bobkreid - 07-29-2022, 09:13 AM
RE: Issue with code? - by RhoSigma - 07-29-2022, 12:16 PM
RE: Issue with code? - by bobkreid - 07-29-2022, 02:43 PM
RE: Issue with code? - by JRace - 07-29-2022, 03:00 PM
RE: Issue with code? - by Pete - 07-29-2022, 05:40 PM
RE: Issue with code? - by JRace - 07-29-2022, 06:02 PM
RE: Issue with code? - by Pete - 07-29-2022, 06:24 PM
RE: Issue with code? - by SMcNeill - 07-29-2022, 06:50 PM
RE: Issue with code? - by Pete - 07-29-2022, 07:23 PM
RE: Issue with code? - by SMcNeill - 07-29-2022, 07:31 PM
RE: Issue with code? - by Pete - 07-29-2022, 07:56 PM
RE: Issue with code? - by bobkreid - 07-30-2022, 03:12 PM
RE: Issue with code? - by Pete - 07-30-2022, 04:02 PM
RE: Issue with code? - by JRace - 07-30-2022, 03:48 PM



Users browsing this thread: 9 Guest(s)