By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,558 Members | 1,675 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,558 IT Pros & Developers. It's quick & easy.

Get Value from Registry using VB.NET

P: n/a
Hi, How can I retrieve something from Registry ?
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
" A_PK" <pk***@hotmail.com> schrieb:
Hi, How can I retrieve something from Registry ?


Take a look at the 'Microsoft.Win32.Registry' class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2

P: n/a
Here's a very simple example:

Imports Microsoft.Win32

Private Function GetRegistryValue(ByVal sKey As String, ByVal sKeyName
As String) As String
Dim reg As RegistryKey
Dim strTemp As String
reg = Registry.CurrentUser.OpenSubKey(sKey)
reg.OpenSubKey(strKey)
If Not (reg Is Nothing) Then
strTemp = reg.GetValue(sKeyName)
reg.Close()
End If
Return strTemp
End Function

I have just coded it for HKEY_CURRENT_USER & it doesn't include any error
trapping, but you get the idea

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.