This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Sunday, January 4, 2009

Clear VS2005 Unwanted Reg values.

Version: VB 2005
Compatibility: VB 2005
Category: Windows Registry



DECLARATION:
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:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger