2010-02-19 81 views
1

先生,我在vs2005中开发了以下代码,现在我只是在我的新项目中使用此模块@ vs 2008 .. 但这个错误已被提升。我不能能解决这个问题...空引用异常未被用户代码处理

Private Sub DataAccess() 

    Dim errHandle As New ErrorHandler 
    Dim lobjCommon As New eCopsCommonFunctions 
    Try 
     AccessCodeDrplst.DataSource = CType(lobjCommon.gfuncGetAllEnrollmentSource(), DataSet) 
     AccessCodeDrplst.DataValueField = "DataAccessCode" 
     AccessCodeDrplst.DataTextField = "DataAccessDesc" 
     AccessCodeDrplst.DataBind() 
     'lstEnrollmentSourceCode.DataValueField = "EnrollmentSourceCode" 
     'lstEnrollmentSourceCode.DataTextField = "EnrollmentSourceDesc" 
     'lstEnrollmentSourceCode.DataBind() 
     '"Beneficiary Election" is pre selected as default value. By pals on Oct 24th 2007 
     'lstEnrollmentSourceCode.SelectedValue = "B" 
     'lstEnrollmentSourceCode.Items.Insert(0, New ListItem("Select", "0")) 
    Catch ex As Exception 
     errHandle.gProcHandleErrors(ex, Session("MemberID"), "SPStatus.aspx.vb, gprocFillSEPCode") 
     Throw ex 
    Finally 
     lobjCommon = Nothing 


     ///here the error occurs as 'NullException was unhandle by the user code' 
     errHandle = Nothing 
    End Try 
End Sub 
+0

什么是'ErrorHandler'? – 2010-02-19 01:45:47

+0

再次检查您发布的Finally块中的代码是否与您的程序中的代码实际匹配。 – 2010-02-20 18:14:44

+0

user238319 - 问题是否已解决? – 2010-02-23 02:54:35

回答

0

是不是由于“捕捉”块内的

Throw ex 

线?

(格式有些出)

顺便说一句,不要 “扔恩” - 只是 “扔”(在异常处理技术,阅读起来)