已经做好的窗体,修改时删除部分控件,再运行时就报错“未将对象引用设置到对象的实例“,而且实在Page_Load之前就报错,很奇怪,重启也无效,请大家帮帮忙
解决方案 »
- 技术实践和理论知识
- 2005,这个模板应该如何设计呢?
- 最近在找工作,想练习写方案,谁能给点意见?
- msdn的中文版出错
- 在页面中显示图片的问题(从数据库中取路径,在REPEATER中显示)
- 用FREETEXTBOX出现的问题,不能上传!!在线等!
- 关于webpart自定义标题背景图片
- 升级ASP.NET2.0原来的站点无法打开,急求
- ||||||超级难,100分!生成3维DataTable的问题|||||||||
- 数据从另一个页面传来之后,如何正确应用到查询语句中,帮帮忙,着急中...
- 页面运行很慢--在线等
- web打印:用户要求把信封放进打印机里 邮编,地址,收信人,等打在信封上。大家有没有好的解决方案啊
看看里面有没有引用了你以删除的控件,有的话就删掉
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ds1 = new lvyou.ds();
((System.ComponentModel.ISupportInitialize)(this.ds1)).BeginInit();
this.LinkButton2.Click += new System.EventHandler(this.LinkButton2_Click);
this.LinkButton3.Click += new System.EventHandler(this.LinkButton3_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
//
// ds1
//
this.ds1.DataSetName = "ds";
this.ds1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.ds1)).EndInit();
}
#endregion还请各位帮忙看看
如果你运行,就会报错你将
#Region " Web 窗体设计器生成的代码 "
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
InitializeComponent()
End Sub#End Region
中相应代码删除
{
this.ds1 = new lvyou.ds();
((System.ComponentModel.ISupportInitialize)(this.ds1)).BeginInit();
this.LinkButton2.Click += new System.EventHandler(this.LinkButton2_Click);
this.LinkButton3.Click += new System.EventHandler(this.LinkButton3_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
//
// ds1
//
this.ds1.DataSetName = "ds";
this.ds1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.ds1)).EndInit();
}
#endregion
->private void InitializeComponent()
{
try{
this.ds1 = new lvyou.ds();//在这加断点,单步执行,看看那出错?
((System.ComponentModel.ISupportInitialize)(this.ds1)).BeginInit();
this.LinkButton2.Click += new System.EventHandler(this.LinkButton2_Click);
this.LinkButton3.Click += new System.EventHandler(this.LinkButton3_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
//
// ds1
//
this.ds1.DataSetName = "ds";
this.ds1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.ds1)).EndInit();
}
catch( Exception ex )
{
//看看ex是什么?
}
}
#endregion