Mega Code Archive

 
Categories / VB.Net / File Directory
 

Delete a file if exist

Imports System Imports System.Windows.Forms Imports System.Collections.Generic Imports System.ComponentModel Imports System.Drawing.Imaging Imports System.Drawing Public Class MainClass    Shared Sub Main()         Dim file_name As String = "test.wmf"         ' Delete the file if it exists.         If Len(Dir$(file_name)) > 0 Then Kill(file_name)    End Sub  End Class