以文本方式查看主题

-  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=149364)

--  作者:cool314156
--  发布时间:2020/4/29 17:28:00
--  [求助] 不能创建网页,报错
Dim e As RequestEventArgs = args(0)


Dim wb As WeUI
Select Case e.Path
    Case "huan.htm"
        \'PopMessage(1)
        Dim hwh As String
If e.PostValues.ContainsKey("货位号") Then
        hwh =  e.Postvalues("货位号")
\'PopMessage(hwh )
msgbox(  hwh  )
    End If    
            \'PopMessage(hwh )
            msgbox(  hwh  )
            Dim dr As DataRow = DataTables("库存").Find("货位号=\'" & hwh & "\'")
            
        
        If dr IsNot Nothing Then
            PopMessage("找到行" )
            \'wb.AddForm("","form1","huan.htm")
            
            With wb.AddInputGroup("form1","ipg2","货位调整")
                With    .AddInput("通用名","通用名","Text")  \'前一个"姓名"是ID,后一个"姓名"是标题
                    .Value = dr("通用名")
                    .Readonly = True
                End With
                With    .AddInput("规格","规格","Text")
                    .Value = dr("规格")
                    .Readonly = True
                    
                End With
                With     .AddInput("批号","批号","Text")
                    .Value = dr("批号")
                    .Readonly = True
                End With
                With  .AddInput("货位号","货位号","Text")
                    .Value = dr("货位号")
                    .Readonly = True
                End With
                \'.AddInput("通用名","通用名","Text")
                .AddInput("数量","数量","number")
                
                \'.AddInput("单位","","Text")
                .AddInput("移入货位","移入货位","Text")
                
                \'.AddInput("日期","日期","date")
            End With
        Else
            msgbox(101)
            \'End If
            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
            End With
            e.WriteString(wb.Build)
        End If
        Dim nms() As String = {"数量","移入货位"} \'不能为空的列名数组
        For Each nm As String In nms
            If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页
                With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!")
                    .icon = "Warn" \'改变图标
                    .AddButton("btn1","返回").Attribute = ""
                End With
                e.WriteString(wb.Build)
                Return ""  \'必须返回
                
            End If
        Next
        nms = New String() {"商品编号","规格","批号","货位号","数量","移入货位"}  \'重新定义了nms数组,增加了两列.
        Dim kr As DataRow = DataTables("转移货位").AddNew()
        For Each nm As String In nms
            If e.PostValues.ContainsKey(nm) Then
                kr(nm) = e.PostValues(nm)
                kr("选择")=True
            End If
        Next
        e.WriteString(wb.Build)
End Select
上面的代码 执行之后就出现报错
.NET Framework 版本:4.0.30319.1
Foxtable 版本:2020.4.10.8
错误所在事件:自定义函数Khuan
详细错误信息:
Exception has been thrown by the target of an invocation.
Object reference not set to an instance of an object.
求版主帮忙改下
[此贴子已经被作者于2020/4/29 17:28:40编辑过]

--  作者:有点蓝
--  发布时间:2020/4/29 17:43:00
--  
        Else
            msgbox(101)
            \'End If
            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
            End With
            e.WriteString(wb.Build)
        End If

什么这段代码移到最后一句End Select之前。

还有问题自己调试看是那一句代码有问题:http://www.foxtable.com/webhelp/scr/1485.htm