以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]菜单的SystemIdle事件执行过程中发生错误 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=144546) |
||||
-- 作者:YDS -- 发布时间:2019/12/24 9:03:00 -- [求助]菜单的SystemIdle事件执行过程中发生错误 菜单的SystemIdle事件执行过程中发生错误 但是我的菜单的SystemIdle根本就没有代码啊
|
||||
-- 作者:有点蓝 -- 发布时间:2019/12/24 9:10:00 -- 怎么测试会出错? |
||||
-- 作者:YDS -- 发布时间:2019/12/24 10:17:00 -- 打开程序以后 接受串口数据的时候 时间不固定 |
||||
-- 作者:YDS -- 发布时间:2019/12/24 10:19:00 -- 2019-12-22 15:36:10.839 System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小。 参数名: index 在 System.Collections.BitArray.Get(Int32 index) 在 System.Data.Common.DataStorage.IsNull(Int32 recordNo) 在 System.Data.DataRow.IsNull(String columnName) 在 Foxtable.VarsCollection.get_Var(String VarName) 在 UserCode.AugGTbz9qun1F5hl9() 这个错误信息是那里出问题了?
|
||||
-- 作者:有点蓝 -- 发布时间:2019/12/24 10:27:00 -- 这个我没有办法测试。Foxtable更新到最新版。 或者试试导入系统菜单,然后把主菜单事件清除掉。或者设计自己的菜单试试
|
||||
-- 作者:YDS -- 发布时间:2019/12/24 12:02:00 -- Static V As Integer If vars("kln") = 1 Then Dim ck As String = Functions.Execute("GET","串口号","LLNJ","值") Dim dll As String = Functions.Execute("GET","地址","拉力","值") Dim dnj As String = Functions.Execute("GET","地址","扭矩","值") Dim dzs As String = Functions.Execute("GET","地址","转速","值") If ck > "" Then If Ports.Contains(ck) Then If Ports(ck).IsOpen Then If Forms("主窗口").Opened Then \'解析接收数据 If vars("jsln") = 1 Or vars("jsln") = 2 Or vars("jsln") = 3 Then Dim jssj As String Select Case vars("jsln") Case 1 jssj = vars("sj1") Case 2 jssj = vars("sj2") Case 3 jssj = vars("sj3") End Select If jssj > "" Then If jssj.StartsWith(dll & "-3-4-") Then Dim VL() As String = jssj.split("-") If VL.Length = 9 Then Dim s,str As String Dim v1 As Integer s = DecToBin(VL(3)).PadLeft(8,"0") & DecToBin(VL(4)).PadLeft(8,"0") & DecToBin(VL(5)).PadLeft(8,"0") & DecToBin(VL(6)).PadLeft(8,"0") Dim bmlx As String = Functions.Execute("GET","编码类型","拉力","值") v1 = Functions.Execute("SN",s,bmlx) Dim bl As Double = Val(Functions.Execute("GET","分辨率","拉力","值")) Dim vv As Double = v1 * bl If math.Abs(vv) < Val(Functions.Execute("GET","极限值","拉力","值")) Then Forms("主窗口").Controls("ll").text = vv End If End If ElseIf jssj.StartsWith(dnj & "-3-4-") Then Dim VL() As String = jssj.split("-") If VL.Length = 9 Then Dim s,str As String Dim v1 As Integer s = DecToBin(VL(3)).PadLeft(8,"0") & DecToBin(VL(4)).PadLeft(8,"0") & DecToBin(VL(5)).PadLeft(8,"0") & DecToBin(VL(6)).PadLeft(8,"0") Dim bmlx As String = Functions.Execute("GET","编码类型","扭矩","值") v1 = Functions.Execute("SN",s,bmlx) Dim bl As Double = Val(Functions.Execute("GET","分辨率","扭矩","值")) Dim vv As Double = v1 * bl If math.Abs(vv) < Val(Functions.Execute("GET","极限值","扭矩","值")) Then Forms("主窗口").Controls("nj").text = vv End If End If ElseIf jssj.StartsWith(dzs & "-3-4-") Then Dim VL() As String = jssj.split("-") If VL.Length = 9 Then Dim s,str As String Dim v1 As Integer s = DecToBin(VL(3)).PadLeft(8,"0") & DecToBin(VL(4)).PadLeft(8,"0") v1 = BinToDec(s) Dim bl As Double = Val(Functions.Execute("GET","分辨率","转速","值")) Dim vv As Double = v1 * bl If math.Abs(vv) < Val(Functions.Execute("GET","极限值","转速","值")) Then Forms("主窗口").Controls("zs").text = vv End If End If End If End If End If \'发送查询命令 If V < 1 Or V > 2 Then V = 1 Else V = V + 1 End If vars("jsln") = V vars("sj" & V) = Nothing Dim ff As uInteger() = {&H0 & V,&H03,&H00,&H00,&H00,&H02} Dim aa As Integer = CRC16(ff,ff.Length) Dim crc As String = DecToHex(aa).ToUpper() crc = crc.PadLeft(4,"0") Dim crcl As Integer = HexToDec(crc.SubString(2,2)) Dim crch As Integer = HexToDec(crc.SubString(0,2)) Dim Vln() As Byte = New Byte() {V,3,0,0,0,2,crcl,crch} Ports(ck).Write(Vln, 0, Vln.Length) End If End If End If End If End If |
||||
-- 作者:YDS -- 发布时间:2019/12/24 12:02:00 -- 2019-12-22 14:32:48.260 索引超出范围。必须为非负值并小于集合大小。 参数名: index 在 System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) 在 System.Collections.Generic.List`1.get_Item(Int32 index) 在 System.Data.RecordManager.NewRecordBase() 在 System.Data.DataTable.NewRecord(Int32 sourceRecord) 在 System.Data.DataRow.BeginEditInternal() 在 System.Data.DataRow.set_Item(DataColumn column, Object value) 在 Foxtable.VarsCollection.set_Var(String VarName, Object value) 在 UserCode.Timer_LLNJ() 这个错误是怎么产生的? |
||||
-- 作者:有点蓝 -- 发布时间:2019/12/24 13:36:00 -- 这个提示好像是全局vars变量,取值或者赋值出错了。 试试改为使用public变量看看
|
||||
-- 作者:YDS -- 发布时间:2020/1/7 11:20:00 -- 我导入了系统的菜单,然后出现了以下错误 2020-01-07 11:00:44.491 Event: SystemIdle Message1: 索引超出范围。必须为非负值并小于集合大小。 参数名: index Message2: System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小。 参数名: index 在 System.Collections.BitArray.Get(Int32 index) 在 System.Data.Common.DataStorage.IsNull(Int32 recordNo) 在 System.Data.DataRow.IsNull(String columnName) 在 Foxtable.VarsCollection.get_Var(String VarName) 在 UserCode.AugGTbz9qun1F5hl9()
|
||||
-- 作者:有点蓝 -- 发布时间:2020/1/7 11:23:00 -- 试试改为使用public变量,替代vars变量 |