Hi all.
I can't figure out what is wrong with this code. What is SUPPOSED to happen is that a drivelistbox is used to select a drive. If the drive is read only, a label reads, "Read-Only." If it is NOT read-only, the label reads, "Writable." Since there is a delay when reading CDs or DVDs, I put a piece of code in there at the top to make the label read, "Waiting for drive status...", so that it would not read incorrectly while the system is checking the drive. Problem is, the message never makes it to the label at runtime, because I think it is being held up by the call to ReliableWriteStatus(). That's why I put the DoEvents line in there, but it does not work. I also put a loop in there at one point as a time-delay, but no go. The form's AutoRedraw property is set to "True".
If I break at the DoEvents line, the "Waiting for drive status..." message does appear, so something is holding up its getting to the screen while the program is running and moves to the next lines.
Many thanks for any help!
I can't figure out what is wrong with this code. What is SUPPOSED to happen is that a drivelistbox is used to select a drive. If the drive is read only, a label reads, "Read-Only." If it is NOT read-only, the label reads, "Writable." Since there is a delay when reading CDs or DVDs, I put a piece of code in there at the top to make the label read, "Waiting for drive status...", so that it would not read incorrectly while the system is checking the drive. Problem is, the message never makes it to the label at runtime, because I think it is being held up by the call to ReliableWriteStatus(). That's why I put the DoEvents line in there, but it does not work. I also put a loop in there at one point as a time-delay, but no go. The form's AutoRedraw property is set to "True".
Code:
Drive1WriteStatus_label.ForeColor = &H80FF& 'Orange.
Drive1WriteStatus_label.Caption = "Waiting for drive status..."
DoEvents
ReliableWriteStatus (Left(Drive1.Drive, 2)) 'Left() function to eliminate volume label that may be tagged onto drive name.
Drive1ReadOnlyFlag = DriveReadOnlyFlag
If Drive1ReadOnlyFlag = 0 Then
Drive1WriteStatus_label.ForeColor = &H8000& 'Green.
Else
Drive1WriteStatus_label.ForeColor = &HC0& 'Red.
End If
Drive1WriteStatus_label.Caption = ReliableWriteStatus_str
Exit Sub
Many thanks for any help!