Clear VS2005 Unwated Regvalues(VB.NET)
Version: VB 2005
Compatibility: VB 2005
Category: Windows Registry
Clear VS2005 Unwanted Reg values.
Declarations:
Imports System
Imports Microsoft.Win32
'Developer :- Gehan Fernando
'Date :- 01-Dec-2008
'Description :- Reset VS2005 Registry Keys
Code:
Public Class FormMRU
'Creeate RegistryKey type variable
Private _regkey As RegistryKey
Private Sub TimerMRU_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerMRU.Tick
'Set system time to LabelTime
LabelTime.Text = Now.ToString("hh:mm:ss tt")
End Sub
Private Sub FormMRU_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Call the TimerMRU control Tick event
TimerMRU_Tick(sender, e)
End Sub
Private Sub ButtonReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonReset.Click
'Delete FileMRUList Sub Key From The Registry
_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0", True)
_regkey.DeleteSubKey("FileMRUList", True)
_regkey.CreateSubKey("FileMRUList", RegistryKeyPermissionCheck.Default)
_regkey.Close()
'Delete ProjectMRUList Sub Key From The Registry
_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0", True)
_regkey.DeleteSubKey("ProjectMRUList", True)
_regkey.CreateSubKey("ProjectMRUList", RegistryKeyPermissionCheck.Default)
_regkey.Close()
'Delete Recent Reference Keys From The Registry
_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0\ComponentPickerPages", True)
_regkey.DeleteSubKeyTree("Recent")
_regkey.CreateSubKey("Recent", RegistryKeyPermissionCheck.Default)
_regkey.Close()
_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0\Find", True)
Dim valueCollection() As String = _regkey.GetValueNames()
'Sort the result
Array.Sort(valueCollection)
Dim len As Int16 = 0
For Each Item As String In valueCollection
len = Item.Trim.Length
If (Item.Substring(0, len) = "Find" Or Item.Substring(0, len).Contains("Find ")) Or _
(Item.Substring(0, len) = "Replace" Or Item.Substring(0, len).Contains("Replace ")) Then
Debug.Print(Item)
_regkey.DeleteValue(Item)
End If
Next
_regkey.Close()
If My.Computer.FileSystem.DirectoryExists(Environment.GetEnvironmentVariable("USERPROFILE") + _
"\My Documents\Visual Studio 2005\Backup Files") Then
My.Computer.FileSystem.DeleteDirectory(Environment.GetEnvironmentVariable("USERPROFILE") + _
"\My Documents\Visual Studio 2005\Backup Files", _
FileIO.DeleteDirectoryOption.DeleteAllContents)
My.Computer.FileSystem.CreateDirectory(Environment.GetEnvironmentVariable("USERPROFILE") + _
"\My Documents\Visual Studio 2005\Backup Files")
End If
MessageBox.Show("Registry Clean.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
_regkey = Nothing
End Sub
End Class
0 comments:
Post a Comment