Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Uses FSO to Check that a Floppy Disk is in drive A...
Author:
Louis Delongchamp
E-mail:
Click to e-mail author
Website:
http://www.cyberbeach.net/~loudelon
Submitted:
7/25/2001
Version:
VB6
Compatibility:
VB6
Category:
File Manipulation
Views:
8047
Uses FSO to Check that a Floppy Disk is in drive A.
Declarations:
Make sure a floppy disk is in the A: drive Start a new VB6 project and place this code in the form.
Code:
Private Sub Form_Load() If FloppyReady Then MsgBox "The Floppy Disk Is Ready!" End End Sub Private Function FloppyReady() As Boolean Dim fsO As Object Dim S As String Set fsO = CreateObject("Scripting.filesystemObject") Do While True On Error Resume Next ' Check for the presence of directories as well as files on the floppy S = Dir$("A:\*.*", vbDirectory) If Err.Number = 52 Then Err.Clear If MsgBox("Put a floppy disk in the A: drive or Click Cancel", vbOKCancel) = vbCancel Then GoTo ErrEnd Else Exit Do End If Loop If S <> "" Then If MsgBox("Floppy disk not empty: Erase the files?", vbYesNo) = vbYes Then If Dir$("A:\*.*", vbNormal) <> "" Then fsO.deletefile ("A:\*") If Dir$("A:\*.*", vbDirectory) <> "" Then fsO.deletefolder ("A:\*") Else GoTo ErrEnd End If End If FloppyReady = True ErrEnd: Set fsO = Nothing End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2023 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement