Avatar of RIAS
RIAS
Flag for United Kingdom of Great Britain and Northern Ireland asked on

How to enter a field and its value in registry key+vb.net

Hi,
How to enter a field and its value in registry key I am using vb.net windows.
Already have this function
 Public Function SetOtherRegSetting(ByVal Section As String, ByVal RegKeyName As String, ByVal Field As String, ByVal value As String) As String
        Dim RegSection As String
        Dim regKeyObject As RegistryKey
        Dim TempObj As Object = ""
        Dim GetSetOtherRegSetting As String = String.Empty
        GetSetOtherRegSetting = ""
        RegSection = Section & "\" & RegKeyName & "\"
        regKeyObject = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(RegSection)
        If Not regKeyObject Is Nothing Then
            TempObj = regKeyObject.GetValue(Field)
            If Not TempObj Is Nothing Then
                GetSetOtherRegSetting = TempObj.ToString()
                TempObj = Nothing
            End If
        Else
            regKeyObject.CreateSubKey("DevArea", RegistryKeyPermissionCheck.Default)
        End If
        regKeyObject.Close()
        Return GetSetOtherRegSetting
    End Function
RegistrySettings.docx
.NET ProgrammingVisual Basic.NETProgramming

Avatar of undefined
Last Comment
RIAS

8/22/2022 - Mon
Nasir Razzaq

What is the code doing? Where does it break?
RIAS

ASKER
The code is retrieving the key value but I dont know how to set it .
SOLUTION
Ambusy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
RIAS

ASKER
Cheers!!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes