Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 2nd, 2008, 09:47 AM
Authorized User
Points: 386, Level: 6
Points: 386, Level: 6 Points: 386, Level: 6 Points: 386, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2007
Location: windsor, toronto, Canada.
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.

Quote:
[HKEY_LOCAL_MACHINE\\SOFTWARE\\QuickProjects.\\QSUp date]
"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,

Code:
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.
Reply With Quote
  #2 (permalink)  
Old September 2nd, 2008, 04:01 PM
Authorized User
Points: 386, Level: 6
Points: 386, Level: 6 Points: 386, Level: 6 Points: 386, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2007
Location: windsor, toronto, Canada.
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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)
            MessageBox.Show(path)
        Else
            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
MessageBox.Show(path)

its working.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:44 PM.


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