vb.net中的NullReferenceException [英] NullReferenceException in vb.net
本文介绍了vb.net中的NullReferenceException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在运行此代码时遇到了一些问题。
你能否解决 NullReferenceException <的运行时错误/ code>在下面生成的代码中
Hi I''m having some problem when running this code.
Can you please solve the run time error of "NullReferenceException
" in following code which was generated
Try
NowTime = DateTime.Now
If IsValidShutdown Then
tblRawTesterShutdown = objDAL.GetRawTesterShutdown(StartTime, NowTime)
asdasdIf tblRawTesterShutdown.Rows.Count > 0 Then
For Each RowItem As DataRow In tblRawTesterShutdown.Rows
objShutdownReport = New ShutdownReportENT
With objShutdownReport
.ShutdownType = _ShutdownType
.TesterID = LineNo
.E_Code = RowItem.Item("E_FIELD").ToString.Trim
.F_Code = RowItem.Item("F_FIELD").ToString.Trim
.G_Code = RowItem.Item("G_FIELD").ToString.Trim
.Status = RowItem.Item("HSA_STATUS").ToString.Trim
.Family = RowItem.Item("FAMILY").ToString.Trim
.Count = CInt(RowItem.Item("COUNTOFLINENO"))
.StartTime = StartTime
.Timestamp = NowTime
.CACHE_FAMILY = RowItem.Item("CACHE_FAMILY").ToString.Trim
If Family = Nothing Then
Family = "'" & .Family & "'"
Else
If Family.IndexOf(.Family) = -1 Then
Family = Family & ",'" & .Family & "'"
End If
End If
End With
objDAL.InsertShutdownReport(objShutdownReport)
Next
Else
Return False
End If
Catch ex As Exception
Throw New Exception("Shutdown: " & ex.Message)
Finally
End Try
Return False
推荐答案
要解决此问题,请按照以下链接的说明操作: System.NullReferenceException - 对象引用未设置为实例一个东西。 VB.Net中的3个常见原因。 [ ^ ]
To solve this issue, please, follow the instructions with this link: System.NullReferenceException – Object reference not set to an instance of an object. 3 common causes in VB.Net.[^]
这篇关于vb.net中的NullReferenceException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文