Registry access.

Dark Kai

Well-known member
Joined
Sep 3, 2003
Messages
48
Hi there.
Does anyone knows how to read and write to the registry?

This is out of the topic but ill ask here anyway.
Im using filestream to read a file. It works but when the file is readonly, why cant i open it ? Ive set the filestream to IO.FileMode.Open but still could not access it.

Thanks in advance.
 
Try specifying "FileAccess.Read" to your Filestream.

This is from MSDN:
Code:
FileStream s2 = new FileStream(name, FileMode.Open, FileAccess.Read, FileShare.Read);
 
Nop... right out the track man...
try Microsoft.Registry

or look to add a reference named Microsoft.Something.Registry

itll look like this
then follow the Online Help
 
I was answering his second question about file access, not the registry question.

Arch4ngel said:
Nop... right out the track man...
try Microsoft.Registry

or look to add a reference named Microsoft.Something.Registry

itll look like this
then follow the Online Help
 
(no worries :) )

Actually, heres some vb.net registry code I used a while back:

Code:
   Private Function RegistryGetString(ByVal registryPath As String, ByVal keyName As String) As String
        Try
            Dim objKey As RegistryKey
            
            search HKEY_LOCAL_MACHINE subpaths:
            objKey = Registry.LocalMachine.OpenSubKey(registryPath )
            Return Convert.ToString(objKey.GetValue(keyName , ""))
        Catch ex As Exception
            ErrorLog(ex)
        End Try
    End Function
 
Back
Top