以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  代码问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=66871)

--  作者:affixed
--  发布时间:2015/4/15 11:40:00
--  代码问题
请问为什么下面的代码运行时一直提示未将对象引用设置到对象实例呢

For Each dt As DataTable In DataTables
    If dt.Caption.Contains("模块") Then
        Output.Show(dt.Caption)
    End If
Next
[此贴子已经被作者于2015/4/15 11:40:43编辑过]

--  作者:Bin
--  发布时间:2015/4/15 11:41:00
--  
C 是什么东西? 你没有声明,或者C是空值
--  作者:affixed
--  发布时间:2015/4/15 11:42:00
--  
打错了,已经修改为dt.Caption

还是同样的错误
[此贴子已经被作者于2015/4/15 11:41:49编辑过]

--  作者:Bin
--  发布时间:2015/4/15 11:42:00
--  
For Each dt As DataTable In DataTables
    If dt.Caption IsNot Nothing  Then
        If dt.Caption.Contains("模块") Then
            Output.Show(dt.Caption)
        End If
    End If
Next

--  作者:affixed
--  发布时间:2015/4/15 11:43:00
--  
哈,谢谢Bin老师。
原来有些datatable没有设置caption而造成的问题。