getting Registry key

H

hakan aktan

Here is an examle by using opennetcf.dll . If you add dll to your project
and Referances it will work fine.
Also check www.opennetcf.org

Imports OpenNETCF.Win32

Imports System.Collections

'Global variable

Private registryKey As RegistryKey

Private Sub btnRegRead_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRegRead.Click

Dim keyName As String = tbKeyName.Text

Dim valueName As String = tbValueName.Text

Dim regValue As String

Try

registryKey = OpenNETCF.Win32.Registry.LocalMachine.CreateSubKey(keyName)

If registryKey.ValueCount = 0 Then

MsgBox("Registry not found.")

Else

regValue = CType(registryKey.GetValue(valueName), String)

MsgBox("Registry Value is : " & regValue)

End If

registryKey.Close()

Catch ex As Exception

MsgBox("Err: " & ex.Message)

End Try

End Sub
 
Y

Yoshitha

Hi All
through my application i'm creating key in registry ( in the account hkey
current user) using the function RegCreateKeyEx of coredll.dll,
Before creating the key i specified it has to check whether the key name
specified is already existed in the registry or not ? if it is not there
then it has to create, or if exists it has to display some message.
can any one tell me how to check this one?

i'm using vs2003 (C#.net)

thanx
yoshitha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top