| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2749 人关注过本帖
标题:VB6.0高手帮忙看看,下标越界,程序哪里有问题。
取消只看楼主 加入收藏
duweixun1987
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2018-3-14
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
VB6.0高手帮忙看看,下标越界,程序哪里有问题。
图片附件: 游客没有浏览图片的权限,请 登录注册


' *
' * (c) Copyright 1997 Yokogawa Electric Corporation
' *
' * system       : CS1000
' * sub-system   : HIS
' * description  : OCX sample
' *

Option Explicit
Option Base 0

Const MaxTagItems = 37&              ' Number of tag name - 1


'
' Get process data
'
Private Sub cmdGetData_Click()


Dim TagItems(MaxTagItems) As String     ' TagNames


Dim i As Integer                        ' Work
Dim Values As Variant                   ' Process value



' Set up item information
    TagItems(0) = "LRCA1101.PV"
    TagItems(1) = "PRA1714.PV"
    TagItems(2) = "LRA1715.PV"
    TagItems(3) = "TR1734.PV"
    TagItems(4) = "PRA8101A.PV"
    TagItems(5) = "LRA8101A.PV"
    TagItems(6) = "TRA8101A.PV"
    TagItems(7) = "PRA8101B.PV"
    TagItems(8) = "LRA8101B.PV"
    TagItems(9) = "TRA8101B.PV"
    TagItems(10) = "PRA8101C.PV"
    TagItems(11) = "LRA8101C.PV"
    TagItems(12) = "TRA8101C.PV"
    TagItems(13) = "PRA8101D.PV"
    TagItems(14) = "LRA8101D.PV"
    TagItems(15) = "TRA8101D.PV"
    TagItems(16) = "PRA8101E.PV"
    TagItems(17) = "LRA8101E.PV"
    TagItems(18) = "TRA8101E.PV"
    TagItems(19) = "PRA8101F.PV"
    TagItems(20) = "LRA8101F.PV"
    TagItems(21) = "TRA8101F.PV"
    TagItems(22) = "PRA8101G.PV"
    TagItems(23) = "LRA8101G.PV"
    TagItems(24) = "TRA8101G.PV"
    TagItems(25) = "PRA8102.PV"
    TagItems(26) = "LRA8102.PV"
    TagItems(27) = "TRA8102.PV"
    TagItems(28) = "PRA8103.PV"
    TagItems(29) = "LRA8103.PV"
    TagItems(30) = "TRA8103.PV"
    TagItems(31) = "PRA8104.PV"
    TagItems(32) = "LRA8104.PV"
    TagItems(33) = "TRA8104.PV"
    TagItems(34) = "PRA8105.PV"
    TagItems(35) = "LRA8105.PV"
    TagItems(36) = "TRA8105.PV"
   
   
   
   
   

' Get process data
CENTUM1.StationName = txtHostName
CENTUM1.GetTagQuality = False
CENTUM1.Transpose = False
Values = CENTUM1.GetTagData(TagItems)





' Write process data
 
 data1.Recordset.Update
 data1.Recordset("LRCA1101") = Values(0)
 data1.Recordset("PRA1714") = Values(1)
 data1.Recordset("LRA1715") = Values(2)
 data1.Recordset("TR1734") = Values(3)
 data1.Recordset("PRA8101A") = Values(4)
 data1.Recordset("LRA8101A") = Values(5)
 data1.Recordset("TRA8101A") = Values(6)
 data1.Recordset("PRA8101B") = Values(7)
 data1.Recordset("LRA8101B") = Values(8)
 data1.Recordset("TRA8101B") = Values(9)
 data1.Recordset("PRA8101C") = Values(10)
 data1.Recordset("LRA8101C") = Values(11)
 data1.Recordset("TRA8101C") = Values(12)
 data1.Recordset("PRA8101D") = Values(13)
 data1.Recordset("LRA8101D") = Values(14)
 data1.Recordset("TRA8101D") = Values(15)
 data1.Recordset("PRA8101E") = Values(16)
 data1.Recordset("LRA8101E") = Values(17)
 data1.Recordset("TRA8101E") = Values(18)
 data1.Recordset("PRA8101F") = Values(19)
 data1.Recordset("LRA8101F") = Values(20)
 data1.Recordset("TRA8101F") = Values(21)
 data1.Recordset("PRA8101G") = Values(22)
 data1.Recordset("LRA8101G") = Values(23)
 data1.Recordset("TRA8101G") = Values(24)
 data1.Recordset("PRA8102") = Values(25)
 data1.Recordset("LRA8102") = Values(26)
 data1.Recordset("TRA8102") = Values(27)
 data1.Recordset("PRA8103") = Values(28)
 data1.Recordset("LRA8103") = Values(29)
 data1.Recordset("TRA8103") = Values(30)
 data1.Recordset("PRA8104") = Values(31)
 data1.Recordset("LRA8104") = Values(32)
 data1.Recordset("TRA8104") = Values(33)
 data1.Recordset("PRA8105") = Values(34)
 data1.Recordset("LRA8105") = Values(35)
 data1.Recordset("TRA8105") = Values(36)

 
 
 
 
 
 
 
 
 

Exit Sub

' Error exit
ERR_EXIT:
MsgBox "ERROR"

End Sub

Private Sub cmdStopData_Click()
tmr = False
End Sub

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()
tmr = True
End Sub


Private Sub Label10_Click()

End Sub

Private Sub tmr_Timer()
cmdGetData.Value = True
End Sub


Private Sub Timer1_Timer()
cmdGetData.Value = True

End Sub
搜索更多相关主题的帖子: Sub Private Values Recordset End 
2018-03-14 15:28
duweixun1987
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2018-3-14
收藏
得分:0 
回复 2楼 ictest
我把这里Const MaxTagItems = 37& 改大了,还是不行!报同样的错
2018-03-14 16:58
快速回复:VB6.0高手帮忙看看,下标越界,程序哪里有问题。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042959 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved