Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 2nd, 2008, 09:47 AM
Authorized User
Join Date: Sep 2007
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get Path from the registry key in VB.NET

I’m using VB.NET application.

"InstallDir"="C:\Program Files\ QuickProjects.\QSUpdate"

Can anyone tell me how to read the full path from registery key?

Sometimes the path might be “C:\Projects\QuickProjects.\QSUpdate”, sometimes it might be “T1\root\Program Files\QuickProjects.\QSUpdate”.

I have no idea knowing what it is… That’s why i need to get it from the registry. Whatever path is in that registry entry is the path I need.

I just want my VB.NET program to determine the full path from the registery key.

I know that the registery key is: HKEY_LOCAL_MACHINE\SOFTWARE\QuickProjects.\QSUpdat e

What I meant by "full path" is the location of where the
registry key been installed. For example: "C:\Program
Files\ QuickProjects.\QSUpdate"

And i tried this code too,

Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\\QuickP rojects.\QSUpdate", False)
Dim value As String = CType(key.GetValue("InstallDir"), String)
key.Close()but value is nothing.

using regedit.exe i double check and Software\\QuickProjects.\QSUpdate exist.

If you know how to find out the path from registry key, please let me know.

Thanks in advance.
Old September 2nd, 2008, 04:01 PM
Authorized User
Join Date: Sep 2007
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts

i tried this,
          Dim path As String
        Dim NewKey As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\QuickPr ojects.\QSUpdate", True)

    If Not NewKey Is Nothing Then
             path= CType(NewKey.GetValue("InstallDir"), String)
            Dim Mykey As RegistryKey = Registry.LocalMachine.OpenSubKey("Software", True)
            'Add one more sub key
            Dim NewKey1 As RegistryKey = Mykey.CreateSubKey("QuickProjects.\QSUpdate")
        'Set value of sub key
            NewKey1.SetValue("InstallDir", "C:\Program Files\QuickProjects.\QSUpdate")
        End If

its working.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Registry Key Object s3ss3s BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 4 May 6th, 2008 01:26 PM
Fetch Licence key from Remote Registry saumya Visual Studio 2005 0 December 3rd, 2007 11:32 PM
create a registry key sentme_mail General .NET 0 January 28th, 2006 09:28 AM
Begin VB.NET Ch12 - Registry CLLinder BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 August 5th, 2005 04:29 AM
Dynamic images from VB .net to CR .net. Given Path Alita Crystal Reports 0 September 22nd, 2004 01:51 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.