怪问题,自己的机子上是正常的,可在测试时提示Formabout_Load事件里“System.NullReferenceException”对象未实例化
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Microsoft.Win32;
namespace 江海运输管理系统
{
///
/// Formabout 的摘要说明。
///
public class Formabout :
System.Windows.Forms.Form
{
private System.Windows.Forms.Label
lbusername;
private System.Windows.Forms.Label
lbcompany;
private System.Windows.Forms.Label lbok;
///
/// 必需的设计器变量。
///
private System.ComponentModel.Container
components = null;
public Formabout()
{
//
// Windows 窗体设计器支持所必需
的
//
InitializeComponent();
//
// TODO: 在
InitializeComponent 调用后添加任何构造函数代码
//
}
///
/// 清理所有正在使用的资源。
///
protected override void Dispose( bool
disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void btok_Click(object sender,
System.EventArgs e)
{
}
private void Formabout_Load(object
sender, System.EventArgs e)
{
RegistryKey register = Registry.CurrentUser;
RegistryKey software = register.OpenSubKey
( "Software" );
RegistryKey microsoft = register.OpenSubKey
( "Microsoft" );
RegistryKey mcsetup = microsoft.OpenSubKey( "MS Setup
(ACME)" );
RegistryKey userinfo = mcsetup.OpenSubKey( "User Info" );
}
private void lbok_Click(object sender,
System.EventArgs e)
{
this.Close();
}
private void Formabout_Closing(object
sender, System.ComponentModel.CancelEventArgs e)
{
this.Close();
}
}
}