怪问题,自己的机子上是正常的,可在测试时提示Formabout_Load事件里“System.NullReferenceException”对象未实例化

chrisJiang 2003-08-19 09:23:29
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();
}
}
}

...全文
28 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
qimini 2003-08-20
  • 打赏
  • 举报
回复
用Debug捕捉一下详细的错误信息
qimini 2003-08-19
  • 打赏
  • 举报
回复
Debug or Release?
chrisJiang 2003-08-19
  • 打赏
  • 举报
回复
是用Administrator登陆的
chrisJiang 2003-08-19
  • 打赏
  • 举报
回复
在自己的机子上是没问题的
chrisJiang 2003-08-19
  • 打赏
  • 举报
回复
是Release的exe文件
lemong 2003-08-19
  • 打赏
  • 举报
回复
Registry 是什么?你的代码好像不全
单步跟踪一下,确定错误触发点
qimini 2003-08-19
  • 打赏
  • 举报
回复
测试机器的当前登陆用户要有Administrator的权限

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧