Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

In a Windows VB.net application, how do I write a code that will give me a particular App's folder location?

Source of info should be Registry.

Thanks

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    I didn't understand what is "App's folder location", but you mention Registry, so here is a code snippet in VB.NET that summarizes how to work with Windows Registry:

    Imports System

    Imports Microsoft.Win32

    Module Module1

    Sub Main()

    ' Create a new key under HKEY_LOCAL_MACHINE\Software as MCBInc

    Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("Software", True)

    ' Add one more sub key

    Dim newkey As RegistryKey = key.CreateSubKey("MCBInc")

    ' Set value of sub key

    newkey.SetValue("MCBInc", "NET Developer")

    ' Retrieve data from other part of the registry

    ' find out your processor

    Dim pRegKey As RegistryKey = Registry.LocalMachine

    pRegKey = pRegKey.OpenSubKey

    ("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0")

    Dim val As Object = pRegKey.GetValue("VendorIdentifier")

    Console.WriteLine("The central processor of this machine is:" + val)

    ' Delete the key value

    Dim delKey As RegistryKey = Registry.LocalMachine.OpenSubKey("Software", True)

    delKey.DeleteSubKey("MCBInc")

    End Sub

    End Module

    More sources below.

    Hope this helps ...

Still have questions? Get your answers by asking now.