Need Assistance?

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!
 
M

Manoj G [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top