以文本方式查看主题

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

--  作者:benwong2015
--  发布时间:2021/9/17 10:03:00
--  循环代码问题

以下红色的代码部分,如果select有多个的话,只循环到第一个之后就不再执行,请问是什么问题
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:代码.txt

                    
                    Dim wls As List(Of DataRow)
                    wls = DataTables("C_LYSQList").SQLSelect("领用单号 = \'"& qgr("领用单号") &"\'")
MessageBox.show(wls.count)
                    Dim i As Integer = 2
                    Dim nms() As String = {"物料名称","品牌","规格","等级","物品序号","申请数量","单位","平均单价","小计","用途","请购原由"}
                    For Each wl As DataRow In wls
                        i = i + 1
MessageBox.show(wl("物料编号"))
                        With wb.AddInputGroup("form1","ipg" & i,wl("物料编号"))
                            For c As Integer = 0 To nms.length -1
                                With .AddInput(nms(c) & i,nms(c) & ":","text")
                                    .Value = wl(nms(c))
                                    .Readonly= True
                                End With
                            Next
                        End With
                    Next

                    With wb.AddRadioGroup("form1","审批意见","审批意见")
                        .Add("同意","同意")
                        .Add("不同意","不同意")
                    End With
                    With wb.AddButtonGroup("form1","btg1",True)
                        .Add("btn1", "提交", "submit")
                        .Add("btn2", "返回清单","","llsp.htm")
                    End With
                    e.WriteString(wb.Build)
                Else
 
[此贴子已经被作者于2021/9/17 10:03:10编辑过]

--  作者:有点蓝
--  发布时间:2021/9/17 10:57:00
--  
提示什么错误?MessageBox弹出什么内容?
--  作者:benwong2015
--  发布时间:2021/9/17 11:19:00
--  
 MessageBox.show(wls.count) 能正常显示wls的数量;

MessageBox.show(wl("物料编号")) 只显示第一个物料的料号,接下来其他的料号不再显示,界面也是显示空白;

--  作者:有点蓝
--  发布时间:2021/9/17 11:51:00
--  
说明MessageBox.show(wl("物料编号")) 后面的代码出错了,如果屏蔽了错误,检查一下日志
--  作者:benwong2015
--  发布时间:2021/9/17 12:10:00
--  
 如果屏蔽了错误,检查一下日志  在哪里检查


--  作者:有点蓝
--  发布时间:2021/9/17 12:26:00
--  
                    For Each wl As DataRow In wls
                        i = i + 1
MessageBox.show(wl("物料编号"))
                        With wb.AddInputGroup("form1","ipg" & i,wl("物料编号"))
MessageBox.show(i)
                            For c As Integer = 0 To nms.length -1
MessageBox.show(nms(c) )
                                With .AddInput(nms(c) & i,nms(c) & ":","text")
MessageBox.show(wl(nms(c)))
                                    .Value = wl(nms(c))
                                    .Readonly= True
                                End With
                            Next
                        End With
                    Next

--  作者:benwong2015
--  发布时间:2021/9/17 13:38:00
--  
只能第一个物料的所有信息遍历一次,就没有了


--  作者:有点蓝
--  发布时间:2021/9/17 13:46:00
--  
关闭退出项目,删除项目所在的文件夹里的bin目录,然后重启项目试试。

还不行请上传实例测试