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
IS THERE ROOM ON THE FLOPPY DISK? USING FSO. Ch...
Author:
Louis Delongchamp
E-mail:
Click to e-mail author
Website:
http://www.cyberbeach.net/~loudelon
Submitted:
7/27/2001
Version:
VB6
Compatibility:
VB6
Category:
File Manipulation
Views:
7782
IS THERE ROOM ON THE FLOPPY DISK? USING FSO. Checks that there is enough room on the floppy to accomodate the file Temp.txt.
Declarations:
Start a new VB6 project and put this code in the form. There MUST be a floppy disk in the A: drive. The floppy can be EMPTY or FULL. You have to create 'Temp.txt' in the right location. The program will indicate the correct location.
Code:
Private Sub Form_Load() If RoomOnFloppy Then MsgBox "There IS room on the floppy disk!" end if End End Sub Private Function RoomOnFloppy() As Boolean Dim WkDir As String Dim fsO As Object, fsF As Object ' Retrieve our current location on the hard drive WkDir = App.Path ' Point ourselves towards the floppy drive Set fsO = CreateObject("Scripting.FileSystemObject") Set fsF = fsO.drives.Item("A:") ' Check the file named Temp.txt is on the hard drive If Dir$(WkDir & "\" & "Temp.txt") = "" Then MsgBox "Please create the file Temp.txt in the directory " & WkDir Else ' Check to see if there is sufficient room on the floppy disk to accomodate Temp.txt If fsF.availablespace > FileLen(WkDir & "\" & "Temp.txt") Then RoomOnFloppy = True Else MsgBox "There is insufficient space on the floppy drive" End If End If Set fsO = Nothing Set fsF = Nothing End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2023 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement