标题:这个程序那个地方错了,请指正
只看楼主
shenying
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2005-3-24
 问题点数:0 回复次数:1 
这个程序那个地方错了,请指正

using System ; using System.Drawing ; using System.Collections ; using System.ComponentModel ; using System.Windows.Forms ; using System.Data ; using Microsoft.Win32 ; public class Form1 : Form { private System.ComponentModel.Container components ; private ListBox listBox1 ; private Button button1 ; public Form1 ( ) { InitializeComponent ( ) ; } file://清除在程序中使用过的资源 public override void Dispose ( ) { base.Dispose ( ) ; components.Dispose ( ) ; } file://初始化程序中使用到的组件 private void InitializeComponent ( ) { this.components = new System.ComponentModel.Container ( ) ; this.button1 = new Button ( ) ; this.listBox1 = new ListBox ( ) ; button1.Location = new System.Drawing.Point ( 16 , 320 ) ; button1.Size = new System.Drawing.Size ( 75 , 23 ) ; button1.TabIndex = 0 ; button1.Text = "读取注册表" ; button1.Click += new System.EventHandler( this.button1_Click ) ; listBox1.Location = new System.Drawing.Point ( 16 , 32 ) ; listBox1.Size = new System.Drawing.Size ( 496 , 264 ) ; listBox1.TabIndex = 1 ; this.Text = "读取主测表信息" ; this.AutoScaleBaseSize = new System.Drawing.Size ( 5 , 13 ) ; this.ClientSize = new System.Drawing.Size ( 528 , 357 ) ; this.Controls.Add( this.listBox1 ) ; this.Controls.Add ( this.button1 ) ; } protected void button1_Click ( object sender , System.EventArgs e ) { listBox1.Items.Clear ( ) ; RegistryKey hklm = Registry.LocalMachine ; RegistryKey software = hklm.OpenSubKey ( "SYSTEM" ) ; file://打开"SYSTEM"子键 RegistryKey no1 = software.OpenSubKey ( "001" ) ; file://打开"001"子键 RegistryKey no2 = no1.OpenSubKey ( "002" ) ; file://打开"002"子键 foreach ( string site in no2.GetSubKeyNames ( ) ) file://开始遍历由子键名称组成的字符串数组 { listBox1.Items.Add ( site ) ; file://在列表中加入子键名称 RegistryKey sitekey = no2.OpenSubKey ( site ) ; file://打开此子键 foreach ( string sValName in sitekey.GetValueNames ( ) ) file://开始遍历由指定子键拥有的键值名称组成的字符串数组 { listBox1.Items.Add ( "" + sValName + ": " + sitekey.GetValue ( sValName ) ) ; file://在列表中加入键名称和对应的键值 } } } public static void Main ( ) { Application.Run ( new Form1 ( ) ) ; } }

搜索更多相关主题的帖子: using System Microsoft public 
2005-03-27 17:25
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
得分:0 
把错误代码帖上来。
2005-03-27 18:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-14166-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014635 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved