.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to use (add, read, change, delete) registry keys with vb.net

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :.NET Framework
Find this tutorial on Dot Net SourceReason of this project:This is the next part of the previous tutorial. We'll learn here how to add, change, read, delete registry keys and values using vb.net.I included a sample that contains all those functionality.Project details:1- How to add a registry key/value2- How to read a registry value3- How to delete a key or a value4- Changing a value or a key5- Hints to use registry with VB.net6- The registry reader (VB.net)1- How to add a registry key/valueOne thing that I think I forget to notice. A folder in the registry is name "key" and the elements in this key are named "values".There's a description of each value type in the 5th tutorialNow we'll see how to add a key or a value.Probably you have thought where we'll put it and whether it's a key or a value.So we have 2 things to notice.Visual Basic will automatically show you the hives (they are stored in).You'll have only to choose the needed one.To do that paste the following line. My.Computer.Registry.CurrentUser.CreateSubKey("TestKey")This line will create a key in the HKEY_CURRENT_USER hive and will be named "testkey"Now let's move on to see how to set a value.For the value we'll need three things: Value path, Value name and value value. We can also precise the value type if not Visual Basic will try to assign the value type depending o

View Complete Post

More Related Resource Links

DataGridView>Edit Columns> Column Read Only property is unwilling to change

Hello, I am facing the following mystery: When changing the read only property of a column to false and reopening the "edit columns" window, it mysteriously turns back to true. Even when closing the designer and changing it in the designer code, the resulting execution does not allow edit, as well as when re-opening the designer you see true again.             this.numberDataGridViewTextBoxColumn1.DataPropertyName = "Number";             this.numberDataGridViewTextBoxColumn1.HeaderText = "Number";             this.numberDataGridViewTextBoxColumn1.Name = "numberDataGridViewTextBoxColumn1";             this.numberDataGridViewTextBoxColumn1.ReadOnly = true;//False is required We thought it might be related to data binding. rebinding the grid did not help as well. The is no other place in the code where it changes. Please advice, Thanks

What registry keys are responsible for file extension association?

I'm trying to associate file extension to start some type of files with my application. Which registry keys I have to modify to be sure, that when user double click at file it opens with my application. And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"? This key created after setting default program by "Open with" dialog. I've tried: string ext=".eee"; RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext); RegistryPermission f = new RegistryPermission(RegistryPermissionAccess.Write, r.Name); f.Assert(); r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured

change and read querystring

I have 2 updatepanels.upnlA: in this updatepanel I show search results based on querystring parametersupnlB: here I have a checkbox list X which filters the search results (allows for narrowing the results)Now when a checkbox in list X is clicked, I do an autopostback, then I need to update the querystring (current URL in users browser) and also update the search results.I have no idea how I would go about this! Im seeing difficulties in changing the URL without doing a response.redirect/server.transfer and reading from the querystring to update the search results.I havent started developing yet, just looking into my options now.

how to change gridview edit/delete name?

I have a gridview and in my code behind i have added the edit/update functions like below now how can i change the name of edit/delete which automatically comes ?  <asp:GridView ID="friendListGridview" runat="server" CellPadding="4"          ForeColor="#333333" GridLines="None"         AllowPaging="true" AutoGenerateColumns="false" Width="80%"  AutoGenerateEditButton="True" DataKeyNames="id"         AutoGenerateDeleteButton="True"     >        <Columns>          <asp:TemplateField                 ItemStyle-HorizontalAlign="Center" HeaderText="<%$ Resources:default, friendList %>"  >                <ItemTemplate>                    <%# Eval("ListName") %>             &nbs

Consistency validation for SQL Server registry keys


I cannot get past this support rule when I attempt to install SQL Server 2008 RC0.  When I attempt to drill into the failure the popup states "The SQL Server registry keys from a prior installation cannot be modified.  To continue, see SQL Server Setup documentation about how to fix registry keys."


First off, why would the SQL Server 2008 RC0 install attempt to modify registry keys from a prior installation if I am attempting to install it side-by-side with a prior install of SQL Server 2005 Developer Edition?  


Second, can anyone point me to the SQL Server Setup documentation that walks me through how to go about fixing these registry keys?


Any help would be greatly appreciated.  Thanks in advance for your help.


Wendell G


Cant read registry during custom action

I have built an installer project that uses a custom action that fires during the AfterInstall event.  I am having a strange problem with this code in Windows 7 64 bit that I am not having under Vista 32 bit.  The problem is that in the 64 bit version, a particular registry key that I need to read is showing up as not having any values, even though it definitely contains over 30 values.  Opening the key does not throw an exception - it just doesn't appear to contain any values.  If I execute my code from an EXE and execute it in Windows 7 64 bit, it does not have this problem - the problem only occurs when I call the code from within the context of the custom action and the custom action works fine on 32 bit vista.  The registry key that I am reading ALREADY EXISTS on the machine - my installer is not creating any keys.  I am totally stumped on this one.  Anybody have an idea about what might be going on here?  Thanks in advance for any suggestions or ideas.


Manual change to "applicationSettings" in app.config file are not read by the application.



Okay...This Application Settings stuff is driving me nuts.  Something conseptually so simple should not be this hard to get working.

Here is my

I have a .NET 4 application in which I generated a web reference from a web service wsdl.

I see that it creates an endpoint property in the app.config file which corresponds to a settings class that is autogenerated.    I compile my release code and copy the executable and config file to a local drive.

By default, the url points to the endpoint that was added by the designer.

Now, I want to change my application configuration to point to the production version the the webservice.

To do this I thought all I had to do was change the value in the app.config file.  However, the application never reads from the config, it's always taking the default setting compiled into the settings class.  I'm at a loss as to why this is happening. 

I have search through this forum and there are so many different posts on application settings but all I want to do is change the config file manually without having to recompile.   I'm not doing any runtime settings modifications. 

What if down the line we change the alias to the web service hosting the service.  I can't imagine Microsoft really expects us to have to rec

Gmail delete , read , unread , archive functionality




Please see the following url  


In that they are displaying gmail functionality in the widget. It shows in the dropdown select all , deselect all , mark selected as read , mark selected as unread , delete selected. This functionality is updated in gmail via c#.net.

If i select delete selected the mail is selected in gmail via c# , i need this code, and also remaining mark selected as read , mark selected as unread , archive also i need for my project. how can i do this via in c# and its updated in gmail.

I also want same things with in the widgets. how can i do this? Is there any coding for this or any third party tool. Please help me any one.


Thanks & Regards


Issue reading x64 Registry keys


I have a C# console app compiled with .Net 2.0 in 32 bit machine. This app run fine in 32bit machine. But when I run in x64 machine I get some issues.

I figured out that the information about app was installed correctly on HKLM\SOFTWARE\Wow6432Node\MyCompany\MyApp\ registry key.

But in my code I have hard coded the following string "SOFTWARE\MyCompany\MyApp"

I thought that WOW64 could translate correctly from "SOFTWARE\MyCompany\MyApp" to SOFTWARE\Wow6432Node\MyCompany\MyApp. I am using the class RegistryKey from the Framework. I know that all is correct because it works in 32bit but seems that I am missing something with x64. I got a look at Registry Redirection and Reflection but could not see a solution. Any idea?





Sharepoint Survey, change "READ ALL" to "READ OWN ONLY"



i played around with a survey, i then I got a go from the boss.

I just forgot to change Read Access from All to Own only.

I have changed it now, but the answers before i changed the setting, is still visible to all users.

How to i fix this ____ up ?



Jakob Olsen

can i change atrial version of SQL 2008 Srv to a licensed version if we have the keys.


now i have aSQL 2008 srv trial version i want to change it to a licensed version by using the command line tool or by other simle technique .i dont want to go for a fresh installation or upgrade.is it possible to do this.i have the license keys with me.

Windows 7 Phone Database Rapid Repository Create Read Update and Delete


Download the code and a fully working example application from http://rapidrepository.codeplex.com/


  1. Introduction
  2. Set up the Rapid Repository
  3. Create, Read, Update and Delete
  4. Bug? Writing to 64/32 bit Registry Keys


    I had been searching for a way to write to the 64 and 32bit (WOW6432Node) registry keys becuase it's hard to predict where external processes I'm working with will be reading from.

    .net 4 has a great new way of pointing explicitly to the keys with the RegistryKey.OpenBaseKey method.  It works fine until I point at:


    RegistryKey RegCUBase32 = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);


    This should (In my mind) Push me to the HKCU\Software\WOW6432Node when I try to write to the HKCU\Software  (that's how things work in HKLM)
    -but it does not

    See the following code:


    using System;
    using Microsoft.Win32;
      public static void test()
       String regPath = "SOFTWARE\\Test"; ;
       RegistryKey TestKey;
       //works fine:
       RegistryKey RegLMBase64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
       TestKey = RegLMBase64.CreateSubKey(regPath);

    Create registry keys on X64 registry during X86 app installation.


    My applications is built with X86 target platform.

    I’m creating the registry keys in HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon for auto-login to windows during my app installation. For this I’m executing a .reg file.

    This process works in any X86 machines normally.

    When I install this in X64 machine, all my registry keys were created under WOW6432Node (HKLM\Software\WOW6432Node\Microsoft\Windows NT\ CurrentVersion \WinLogon). Due to this issue auto-login not happening upon machine reboots.

    How to create the registry keys under HKLM\Software\Microsoft\Windows NT\ CurrentVersion \WinLogon during installation?

    Thanks in advance.


    Change database state to / from Standby / Read-Only to Normal


    I've got log shipping running as part of my DR strategy and the recovery database shows up on the DR server in Standby / Read-Only mode.  In the case of distaster how would I change the database from Standby mode into Normal mode?

    The database is almost 10GBs and I'd like to test out a recovery while being able to then turn the database back into recovery mode after the test.  Is that possible?




    Steve Berg

    Follow Steve on Twitter

    Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

    In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

    The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

    Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

    In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend