Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21866

DoEvents not Doing

$
0
0
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".

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

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!

Viewing all articles
Browse latest Browse all 21866

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>