我做的是一个登入窗口 :Function passExam() As Boolean
If txtNum.Text = Session("num").ToString Then
Return True
Else
Return False
End If
End Function
其中txtNum.Text是验证用的。发现的错误时:未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:行 95:
行 96: Function passExam() As Boolean
行 97: If txtNum.Text = Session("num").ToString Then
行 98: Return True
行 99: Else
源文件: D:\My Documents\Visual Studio 2005\WebSites\WebSite15\bbs\Reg.aspx.vb 行: 97堆栈跟踪:[NullReferenceException: 未将对象引用设置到对象的实例。]
bbs_Reg.passExam() in D:\My Documents\Visual Studio 2005\WebSites\WebSite15\bbs\Reg.aspx.vb:97
bbs_Reg.btnExce_Click(Object sender, EventArgs e) in D:\My Documents\Visual Studio 2005\WebSites\WebSite15\bbs\Reg.aspx.vb:112
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +97
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4915
If txtNum.Text = Session("num").ToString Then
Return True
Else
Return False
End If
End Function
其中txtNum.Text是验证用的。发现的错误时:未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:行 95:
行 96: Function passExam() As Boolean
行 97: If txtNum.Text = Session("num").ToString Then
行 98: Return True
行 99: Else
源文件: D:\My Documents\Visual Studio 2005\WebSites\WebSite15\bbs\Reg.aspx.vb 行: 97堆栈跟踪:[NullReferenceException: 未将对象引用设置到对象的实例。]
bbs_Reg.passExam() in D:\My Documents\Visual Studio 2005\WebSites\WebSite15\bbs\Reg.aspx.vb:97
bbs_Reg.btnExce_Click(Object sender, EventArgs e) in D:\My Documents\Visual Studio 2005\WebSites\WebSite15\bbs\Reg.aspx.vb:112
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +97
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4915
Return True
Else
Return False
End If
If txtNum.Text = Session("num").ToString Then //赋值!