Need Assistance?

  • Thread starter Thread starter Omega Warrior
  • Start date Start date
O

Omega Warrior

I have a problem with the following code:

The Form1 Class inherits:
Inherits System.Windows.Forms.Form

Public Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer3.Tick



End Sub



Public Function DeleteFolder(ByVal strPath As String) As Boolean

Dim objDir As New DirectoryInfo("C:\test")

Try

objDir.Delete(True)

Return True

Catch

Return False

End Try

End Function





I need to call the function DeleteFolder in Timer3_tick?

Imports: System.IO



And if this code is wrong can someone tell me whats the code for deleting a
folder (full with files), deleting the folder itself or deleting just the
files inside the folder?


This is a windows application done with VB.NET!


Thank You Very Much!
 
I think it is left to you to decide what is required for your application. I
feel deleting the directory itself and recreating a new one with the same
name might be a little faster that looping throught the file list and
deleting them individually. Also, I dont think you have a single method for
the latter in the BCL.
 
Back
Top