Visual Basic is a Microsoft programming language that allows you to create and delete files on a computer. Cookie files are created by the Web browser when you browse a Web page. Temp files are created when you install a program or open a file. A temp file creates a backup, so your changes are saved periodically in case your computer crashes. Cookie and temp files take up space on a computer, and Visual Basic provides syntax to delete these files.
- Skill level:
Other People Are Reading
Click the Windows "Start" button. Click "All Programs," "Microsoft .NET Framework" and then the "Visual Studio" shortcut. This opens your Visual Studio programming tool.
Double-click your Visual Basic project name. Visual Studio opens all of your project files and shows them in a panel labelled "Solution Explorer." Right-click the file you want to use to delete the files. Select "View Code" to display the Visual Basic code file.
Type in the following code to delete cookie files:
Dim cookie As HttpCookie
cookie = New HttpCookie("cookie_name")
cookie.Expires = DateTime.Now.AddDays(-1D)
Replace "cookie_name" with the name of the cookie file you want to delete. This code sets the expiration date of the cookie in the past, which makes Windows delete the file from the system.
Type in the following code to delete temp files:
The "." syntax deletes all files in the Temp directory. If you only want to delete one file, type the name of the file instead of ".."
Click the "Save" option to save your code. Click "Run" to view the changes in the Visual Studio debugger.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for