以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  动态数组  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=157181)

--  作者:石四
--  发布时间:2020/10/6 15:17:00
--  动态数组

图片点击可在新窗口打开查看此主题相关图片如下:57.png
图片点击可在新窗口打开查看
i = 1 时,结果正确。

图片点击可在新窗口打开查看此主题相关图片如下:12.png
图片点击可在新窗口打开查看
i = 2 时,结果不正确。
查不出哪的问题!


--  作者:有点蓝
--  发布时间:2020/10/6 15:24:00
--  
麻烦代码贴出来,不仅要截图。另外正确结果应该是怎么样的?
[此贴子已经被作者于2020/10/6 15:24:00编辑过]

--  作者:石四
--  发布时间:2020/10/6 15:29:00
--  
Dim i As Integer = 2
Dim n As Integer = 3 + i * 4
Dim Multi(n) As String
Multi(0) = "s2020060001"
Multi(1) = "55000"
Multi(2) = "0XR52544"
Multi(3) = "1001-101"
For a As Integer = 1 To i
    Multi(3+(1*a)) = "RO"
    Multi(3+(2*a)) = "h001"
    Multi(3+(3*a)) = 50.0
    Multi(3+(4*a)) = 20201006
Next
Output.Show(Multi(0))
Output.Show(Multi(1))
Output.Show(Multi(2))
Output.Show(Multi(3))
Output.Show(Multi(4))
Output.Show(Multi(5))
Output.Show(Multi(6))
Output.Show(Multi(7))


--  作者:石四
--  发布时间:2020/10/6 15:30:00
--  
根据表的行数动态生成数组,再拼接成字符串,生成二维码。


--  作者:石四
--  发布时间:2020/10/6 15:34:00
--  
Dim i As Integer = 2
Dim n As Integer = 3 + i * 4
Dim Multi(n) As String
Multi(0) = "s2020060001"
Multi(1) = "55000"
Multi(2) = "0XR52544"
Multi(3) = "1001-101"
For a As Integer = 1 To i
    Multi(3+(1*a)) = "RO"
    Multi(3+(2*a)) = "h001"
    Multi(3+(3*a)) = 50.0
    Multi(3+(4*a)) = 20201006
Next

Dim v As String
For j As Integer = 0 To n
   v = v & Multi(j) & ","
Next
output.show(v)

测试结果v = "s2020060001,55000,0XR52544,1001-101,RO,RO,50,h001,,50,,20201006,"
不正确


--  作者:有点蓝
--  发布时间:2020/10/6 16:34:00
--  
Dim i As Integer = 2
Dim n As Integer = 3 + i * 4
For a As Integer = 1 To i
    Output.Show(0+(4*a))
    Output.Show(1+(4*a))
    Output.Show(2+(4*a))
    Output.Show(3+(4*a))
Next
Output.Show("---------")
For a As Integer = 1 To i
    Output.Show(3+(1*a))
    Output.Show(3+(2*a))
    Output.Show(3+(3*a))
    Output.Show(3+(4*a))
Next

--  作者:石四
--  发布时间:2020/10/7 10:36:00
--  
Dim i As Integer = 2
Dim n As Integer = 3 + i * 4
Dim Multi(n) As String
Multi(0) = "s2020060001"
Multi(1) = "55000"
Multi(2) = "0XR52544"
Multi(3) = "1001-101"
For a As Integer = 1 To i
    Multi(0+(4*a)) = "RO"
    Multi(1+(4*a)) = "h001"
    Multi(2+(4*a)) = 50.0
    Multi(3+(4*a)) = 20201006
Next
Dim v As String
For j As Integer = 0 To n
   v = v & Multi(j) & ","
Next
output.show(v)
------------------
OK,谢谢蓝版!