以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]未将对象引用设置到对象的实例  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=73449)

--  作者:cyh2013
--  发布时间:2015/8/19 14:44:00
--  [求助]未将对象引用设置到对象的实例
以下代码实现:选中窗口“信息查询” 中 副本表“tabresult"中的行,然后按选中行中的”品类编号“值,,在表”业态分类“中查询相应信息条

代码如下,,,但运行时会提示”未将对象引用设置到对象的实例“的错误,,,,请教哪里出问题了??


Dim str As String
Dim Frm As WinForm.Form = Forms("信息查询")
If  Tables("信息查询_tabResult").Rows.Count > 0 Then
    str = Tables("信息查询_tabResult").Current("品类编号") 
    Dim dt As DataTable = DataTables("业态分类表")
    Dim r As DataRow
    r = dt.Find("[品类编号] = \'" & str & "\'")
    Frm.Controls("txtClass").Text = r("大类").SubString(1) & "/" & r("业态").SubString(1) & "/" & r("业种").SubString(2) & "/" & r("品类").SubString(2)
End If

--  作者:大红袍
--  发布时间:2015/8/19 14:48:00
--  
Dim str As String
Dim Frm As WinForm.Form = Forms("信息查询")
If frm.Opened AndAlso Tables("信息查询_tabResult").Rows.Count > 0 Then
    str = Tables("信息查询_tabResult").Current("品类编号")
    Dim dt As DataTable = DataTables("业态分类表")
    Dim r As DataRow
    r = dt.Find("[品类编号] = \'" & str & "\'")
    If r IsNot Nothing Then
        Frm.Controls("txtClass").Text = r("大类").SubString(1) & "/" & r("业态").SubString(1) & "/" & r("业种").SubString(2) & "/" & r("品类").SubString(2)
    Else
        Frm.Controls("txtClass").Text = Nothing
    End If
End If