以文本方式查看主题

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

--  作者:mtx
--  发布时间:2019/11/29 17:00:00
--  计时器相关
老师,您好,我怎么能让表2第一秒的时候读取表1中的第一行参数,第2秒的时候读取第二行参数呢?表1中是有数据的,想用表2计时读取其中的一行~~望老师不吝赐教
图片点击可在新窗口打开查看此主题相关图片如下:计时器.png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2019/11/29 17:03:00
--  
利用position(http://www.foxtable.com/webhelp/topics/0446.htm

或者使用全局变量存储行索引,每次+1



--  作者:mtx
--  发布时间:2019/11/29 17:23:00
--  
老师,我只能写出这个代码,怎么将表1的数据读在表2中呢,我这个代码不能做到这个功能


Dim t As Table = Tables("operating_parameter2")
For i As Integer = 0 To t.Rows.Count -1 
If t.position = t.rows.count - 1 Then
t.position  = 0
Else
t.position  = i
End If
Next

--  作者:有点蓝
--  发布时间:2019/11/29 17:28:00
--  
Dim t As Table = Tables("operating_parameter1")
If t.position = t.rows.count - 1 Then
t.position  = 0
Else
t.position  = t.position + 1
End If

读在表2指什么,把表1 数据复制过去表2?
[此贴子已经被作者于2019/11/29 17:28:30编辑过]

--  作者:mtx
--  发布时间:2019/11/29 17:34:00
--  
对的, 我想把表1的数据复制在表2中,上面的代码是在表1中1秒显示1行,我想实现的效果是在表2中第一秒的时候显示表1中的第一行参数,第2秒的时候显示第二行参数
--  作者:有点蓝
--  发布时间:2019/11/29 17:36:00
--  
加上http://www.foxtable.com/webhelp/topics/1533.htm

Dim t As Table = Tables("operating_parameter1")
If t.position = t.rows.count - 1 Then
t.position  = 0
Else
t.position  = t.position + 1
End If
Dim dr2 As DataRow = DataTables("operating_parameter2").AddNew()
For Each dc As Col in t.Cols
  dr2(dc.Name) = t.current(dc.name)
Next

--  作者:mtx
--  发布时间:2019/11/29 20:59:00
--  
老师,我运行了一遍,这个代码还是不能实现表2显示表1的数据,只能在表1中显示
--  作者:有点蓝
--  发布时间:2019/11/29 21:19:00
--  
请上传实例说明
--  作者:mtx
--  发布时间:2019/11/29 21:29:00
--  
我输入的代码是这样的,但是数据只会在表1中换行,不能在表2 中显示
图片点击可在新窗口打开查看此主题相关图片如下:示例说明.png
图片点击可在新窗口打开查看



Dim t As Table = Tables("operating_parameter1")
If t.position = t.rows.count - 1 Then
t.position  = 0
Else
t.position  = t.position + 1
End If

Dim dr2 As DataRow = DataTables("operating_parameter2").AddNew()
For Each dc As Col In t.Cols
  dr2(dc.Name) = t.current(dc.name)
Next

--  作者:有点蓝
--  发布时间:2019/11/29 21:44:00
--  
请把滚动条拉到最下面,这个代码是每次增加一行到最后面的