
在vb6.0中每5秒读取List1下一条信息 5
PrivateSubCommand3_Click()DimiDimsFori=0ToList1.ListCount-1List1.ListIndex=i'请在这里写出每5...
Private Sub Command3_Click()
Dim i
Dim s
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
'请在这里写出每5秒向下读取
Next
End Sub
如果用timer控件,如何用,请把代码写出来;另外public function gettime(jin as interger) 提示”用户定义类型未定义” 展开
Dim i
Dim s
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
'请在这里写出每5秒向下读取
Next
End Sub
如果用timer控件,如何用,请把代码写出来;另外public function gettime(jin as interger) 提示”用户定义类型未定义” 展开
4个回答
展开全部
1、在界面上放一个Timer控件,把它的Interval值设置为5000(即5秒)
2、在通用部分定义一个公共变量iListIndex
Public iListIndex As Integer
3、在Form_Load中给iListIndex赋一个初始值(这部分根据你的需要在不同的位置给iListIndex赋一个初始值,可以不在Form_Load中)
Private Sub Form_Load()
iListIndex = -1
End Sub
4、在Timer1_Timer中写下如下语句
Private Sub Timer1_Timer()
iListIndex = iListIndex + 1
Text1.Text = List1.List(iListIndex)
End Sub
2、在通用部分定义一个公共变量iListIndex
Public iListIndex As Integer
3、在Form_Load中给iListIndex赋一个初始值(这部分根据你的需要在不同的位置给iListIndex赋一个初始值,可以不在Form_Load中)
Private Sub Form_Load()
iListIndex = -1
End Sub
4、在Timer1_Timer中写下如下语句
Private Sub Timer1_Timer()
iListIndex = iListIndex + 1
Text1.Text = List1.List(iListIndex)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在模块里加如以下函数:
public function gettime(jin as interger)
ss=timer
do
doevents
tt=timer
if tt-ss>jin then exit do
loop
end function
然后这是你的程序
Private Sub Command3_Click()
Dim i
Dim s
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
gettime 5'请在这里写出每5秒向下读取
Next
End Sub
public function gettime(jin as interger)
ss=timer
do
doevents
tt=timer
if tt-ss>jin then exit do
loop
end function
然后这是你的程序
Private Sub Command3_Click()
Dim i
Dim s
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
gettime 5'请在这里写出每5秒向下读取
Next
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
使用一个Timer控件及全局变量或静态变量
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用timer控件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询