Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a seteup exe file to write to the registry 2

Status
Not open for further replies.

flybravo

Programmer
Jun 30, 2003
35
US
So far I can add a user interface to the installation file and add the files. I can not seem to figure out how to have a user enter a value on one of the textboxes and have the data be inserted in a registry string value. Any suggestions will he help full.

Thanks
 
You will need to IMPORT :

Imports System.Diagnostics
Imports Microsoft.Win32

Then define the registry Key:

Public regKey As RegistryKey

Then it depends where you want to define the entry. The following code defines a key for current user in the Software entry. It creates a sub entry (Bowstore) and then creates an entry for Indir and set the value of Indir to C:

regKey = Registry.CurrentUser.OpenSubKey("Software", True)
regKey.CreateSubKey("Bowstore")
regKey = regKey.OpenSubKey("Bowstore", True)
regKey.CreateSubKey("Indir")
regKey.SetValue("Indir", "C:")
regKey.Close()

Hope this helps
 
When I use Imports...it doesn't know what to do (squiggly lines) . Also, I get an error with the "Registry" part of Registry.Currentuser. Do I need to be referencing something? Thanks.
 
are you saying that "Imports" has a squigly line under it, or that the thing being imported has a squigly line under it?

if the thing you are importing has a squigly line under it then you need to add a reference to your project to what ever item has the namespace you want to use.

if Imports has a squigly line under it, something is wrong. Make sure that it is the first code line in the file.

-Rick

----------------------
 
I am typing this as code for a button click event on a form on vb.net. Is that not correct? As soon as I type Imports and a space I get the line.
 
I figured it out. It has to go before the class statement for the form. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top