User:WikiWriter/Customise.This()

Customise.This is a Windows application written in VB.NET for customising, on a per-user basis, the Windows user interface, and settings. It is an easy to use GUI that allows users to 'toggle' / change values in the registry indirectly. This allows users to change registry key values safely, without having any knowledge of the registry structure to do so.

Constants
The most 'generic' parts of the 'registry paths' are stored in constants - for example :  Private Const keyExplorer = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" Private Const keyAdvanced = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"

Reading from the registry
Using the constants above simplifies reading values from the registry.

getUsername
This function uses the keyExplorer constant to read the name of the current-user from the registry :  Function getUsername As String getUsername = My.Computer.Registry.GetValue(keyExplorer, "Logon User Name", 5) End Function

Browsing for a folder
The following code opens the 'FolderBrowserDialog' when a button is clicked, and reports the name of the selected folder using a message box.  Private Sub launchFolderBrowser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles launchFolderBrowser.Click Dim TheFolderDialog As New FolderBrowserDialog 'OpenFileDialog

TheFolderDialog.Description = "Navigate to the " TheFolderDialog.RootFolder = Environment.SpecialFolder.MyDocuments TheFolderDialog.ShowNewFolderButton = False TheFolderDialog.ShowDialog

MsgBox(TheFolderDialog.SelectedPath) End Sub