-
Ok, I want to make a funny program to scare:eek: my friend :D, but I need some help:(. I want to do so when they press a command button, a label that is on the form, will show every file in a desired directory. And I want it to show the files really fast so it looks like it's deleting the files from there, but it's actually not doing anyting harmful to the dir...
Any Help would be great!
Thanks!
-Emo
-
Code:
Needed: FileListBox, Command Button, Label
Private Sub Command1_Click()
On Error Resume Next
For i = 0 to File1.ListCount
Label1.caption = File1
File1.ListIndex = File1.ListIndex + 1
Next i
End Sub
-
Thnaks, but...
Thanks for the reply, but it has some side effects... the first thing, is that if I move my mouse while it's listing(deleting) the files, they speed up. Now this is not that big problem, but at the end, the command button renames it self to the last file in the List1...
Do you know how can I fix this?
Thanks!
-Emo
-
Code:
Private Sub Command1_Click()
On Error Resume Next
For i = 0 to File1.ListCount
Label1.caption = File1
File1.ListIndex = File1.ListIndex + 1
Next i
Command1.caption = File1
End Sub
If you'd rather have it listing the files you are "deleting":
Code:
Needed: Listbox, Command Button, Label
Dim FileFinder
FileFinder = Dir("C:\Windows\*.*")
Do Until FileFinder = ""
List1.AddItem LCase("C:\Windows\" & FileFinder)
Label1.Caption = "Deleting " & FileFinder & "....."
FileFinder = Dir
DoEvents
Loop
Label1.Caption = "C:\Windows\*.* - DELETED!"
If you want it a bit slower, but a bit faster:
Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Dim FileFinder
FileFinder = Dir("C:\Windows\*.*")
Do Until FileFinder = ""
List1.AddItem LCase("C:\Windows\" & FileFinder)
Label1.Caption = "Deleting " & FileFinder & "....."
FileFinder = Dir
DoEvents
Sleep 30
Loop
Label1.Caption = "C:\Windows\*.* - DELETED!"
End Sub
[Edited by Matthew Gates on 07-31-2000 at 11:06 PM]