本文介绍了空引用异常未处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我收到了Null Reference Exception未处理的错误.该错误显示:
行上的对象引用未设置为对象的实例"j=localgroupdata.Tables("GroupTable").Rows.Count()
如果我设置j = 10,则错误显示在i:For i = 0 To (j - 1)
请帮我.
*******************************************
Hi!
I''m getting Null Reference Exception unhandled error. The error shows: "Object reference not set to an instance of an object" on the line j=localgroupdata.Tables("GroupTable").Rows.Count()
If I set j=10, the error shows on i:For i = 0 To (j - 1)
Please help me.
***************************************
Private Sub FillListbox()
Dim i, j As Integer
Dim localGroup As New Group()
localgroupdata = localGroup.GetGroups()
localGroup = Nothing
j = localgroupdata.Tables("GroupTable").Rows.Count()
For i = 0 To (j - 1)
lstGroups.Items.Add(localgroupdata.Tables(0).Rows(i)(0))
Next
lstGroups.SelectedIndex = 0
End Sub
******************************************
谢谢!
**************************************
Thanks!
推荐答案
这篇关于空引用异常未处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!