Originally Posted by
Roger Fang
I am making a realmlist changer in vb.net and cannot seem to be able to delete the cache file through code. Does anyone have any code suggestions as to how I may do this. I have searched the internet and have found nothing as of yet.
Help is greatly appreciated and will always be rewarded with reputation points
Here this code should work for VB.NET if it doesn't just tell me and I will figure out what is wrong. Also I cannot remember if the Form1 part is required just try both ways.
Code:
Imports System.IO
Public Class Form1 Inherits System.Windows.Forms.Form
'Windows Form Designer Generated Code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click
Try
Directory.DeleteDirectory(TextBox1.Text)
'Delete a directory by specifying a path in the TextBox, of the form c:\examples
'Instead of using a TextBox you can directly type the location of the directory like this
'Directory.DeleteDirectory("c:\examples")
Catch
End Try
MsgBox("Done")
End Sub
Hope I helped. ^^