How to Use Visual C # To create and modify Registration Information & lt; zt & gt;-Windows development-. NET tutorial

Source: Internet
Author: User

In the articles "how to read Registration Information" and "use Visual C # To delete registration information in the Registry", we have discussed how to use Visual C # To read and delete registration information in the registry, in this article, we will introduce the other two important operations of Visual C # registry programming: creating registration information and modifying registration information.
In the last two articles, we already know that because Visual C # does not have a class library, it passes through.. Net Framework.. Net FrameWork SDK (software development kit) defines some classes to perform registry operations. This is the two classes encapsulated in the namespace Microsoft. Win32: Registry class and RegistryKey class. The RegistryKey class defines two methods to create the primary key, subkey, and key value in the registry. They are the CreateSubValue () method and the SetValue () method. So how to use Visual C # To modify registration information, in this article, we just introduced how to modify the key value in the registry. For primary keys and subkeys, because the. Net FrameWork SDK does not define this method, you cannot safely modify the information in the registry. The following describes how to use Visual C # To create registration information.
I. Visual C # two methods to be called to create and modify registration information:
(1). CreateSubKey (String key) method: This method is a subkey with the name of the created String. Of course, this method not only creates subkeys, but also creates a primary key in the program described below.
(2 ). setValue (String name, String keyvalue) method: This method has two functions: one can be used to rename the key value, and the other can be used to create a new key value. The specific situation is as follows: if this key value exists in the opened subkey, the new value is assigned to it for renaming. If not, a new key value is created.
2. Programming and running environment and preparations:
I> Windows 2000 Server Edition
II>. Net FrameWork SDK Beta 2
III> to modify an existing key value in a program, you must set the location of the key value in advance. Open the Registry Editor and create the aaa sub-key under the "HARDWARE" sub-key under the "HKEY_LOCAL_MACHINE" primary key and create a key value named "bbb" under the sub-key. As shown in:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.