以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]代码报错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=69515) |
-- 作者:青鸟 -- 发布时间:2015/6/6 13:59:00 -- [求助]代码报错 下面一段代码,希望在导航窗口中动态生成一个提示,但对红色代码段提示:“对于用显示界限声明的数组不允许进行显示初始化!”,估计后面的:tl(i)的表达也有错,请教怎么修改? Dim fyfq As String = DataTables("合同or费用台账").GetComboListString("费用分期") \'费用分期_字符串 Dim fyfqqs() As String \'费用分期期数_数组 fyfqqs = fyfq.split("|") For i As Integer = 0 To fyfqqs.length - 1 If fyfq.Contains(" & fyfqqs(i) &") Then Dim cnt(i) As Integer = DataTables("合同or费用台账").Compute("Count(费用分期)","费用分期 = \'& fyfqqs(i) &\'") Dim ye As String = DataTables("营销费分期审定表").Compute("Sum("本期营销费总额")","营销费分期 = \'& fyfqqs(i) &\'") - DataTables("合同or费用台账").Compute("Sum(合同or费用总额)","费用分期 = \'& fyfqqs(i) &\'") Page.Links.Add("营销费分期记录","& fyfqqs &" & "营销费记录共(" & cnt(i) & ")条" & "目前截止结余 \' & ye & \'") Dim tl(i) As WinForm.TopicLink tl(i) = Forms("入口窗口").Controls("TopicBar1").Pages("提示信息").Links("营销费分期记录") tl(i).ImageFile = "Paste.ico" End If Next
|
-- 作者:Bin -- 发布时间:2015/6/6 14:03:00 -- Dim cnt(i) As Integer 这句代码有错.不能这么定义 Dim cnt As Integer = DataTables("合同or费用台账").Compute("Count(费用分期)","费用分期 = \'& fyfqqs(i) &\'")
|
-- 作者:青鸟 -- 发布时间:2015/6/6 15:18:00 -- 谢谢Bin!只循环一次的代码都调试好了,运行正确。但不同的 i 对应不同的 cn 和 tll,所以希望把 i 作为 cn 和 tll 的下标,该怎么办呢? Dim fyfq As String = DataTables("合同or费用台账").GetComboListString("费用分期") \'费用分期_字符串 Dim aaa As Double Dim bbb As Double Dim ye As Double \'余额 Dim fyfqqs() As String \'费用分期期数_数组 fyfqqs = fyfq.split("|") For i As Integer = 0 To fyfqqs.length - 1 If fyfqqs(i) <> "" Then msgbox(fyfqqs(i)) Dim cn As Integer = DataTables("合同or费用台账").Compute("Count(费用分期)","费用分期 = \'" & fyfqqs(i) & "\'") msgbox(cn) aaa = DataTables("营销费分期审定表").Compute("Sum(本期营销费总额)","营销费分期 = \'" & fyfqqs(i) & "\'") bbb = DataTables("合同or费用台账").Compute("Sum(合同or费用总额)","费用分期 = \'" & fyfqqs(i) & "\'") ye = (aaa - bbb) / 10000 ye = Format(ye,"#####.00") msgbox(ye) Page.Links.Add("营销费分期记录","\'"& fyfqqs(i) &"\'" & "营销费记录共(" & "\'" & cn & "\'" & ")条,目前截止结余额(" & "\'" & ye & "\'" & ")万元") Dim tll As WinForm.TopicLink tll = Forms("入口窗口").Controls("TopicBar1").Pages("提示信息").Links("营销费分期记录") tll.ImageFile = "Paste.ico" End If Next |
-- 作者:Bin -- 发布时间:2015/6/6 15:25:00 -- 用集合. |
-- 作者:青鸟 -- 发布时间:2015/6/6 15:53:00 -- 搞定了,非常感谢! |