我的水平只能做到这样了,报错:
.NET Framework 版本:4.0.30319.18063
Foxtable 版本:2021.12.30.1
错误所在事件:窗口,窗口1,Button1,Click
详细错误信息:
Unable to cast object of type 'System.String[]' to type 'System.Collections.Generic.IEnumerable`1[System.Int32]'.
应该是红色标注代码问题,请教应怎么处理,另绿色标注代码能这样写吗?
Dim bds As Integer
Dim zu As String
Dim Names() As Integer = {11,12,13,14,15,16,17,18,19}
Dim s1 As New List(of Integer)
Dim s2 As New List(of Integer)
s1.AddRange(Names) '将数组中的元素全部加入到集合中
s2.AddRange(s1) '将集合s1中的元素全部加入到集合s2中
Dim fh() As String = {"+","-","*","/"}
Dim t1 As New List(of Integer)
Dim t2 As New List(of Integer)
t1.AddRange(fh) '将数组中的元素全部加入到集合中
t2.AddRange(t1) '将集合s1中的元素全部加入到集合s2中
For i As Integer = 0 To s2.count -1
For c As Integer = 0 To t2.count -1
zu = s2(i) & "'" & t2(c) & "'" And "(" & s2(i) & "'" & t2(c) & "'" '同时有两种情况,可这样写吗?
Next
s2.RemoveAt(i)
For i2 As Integer = 0 To s2.count - 1
For c As Integer = 0 To t2.count -1
If zu Like "(*" Then
zu = zu & s2(i2) & ") '" & t2(c) & "'" Or zu & s2(i2) & "'" & t2(c) & "'"
Else
zu = zu & s2(i2) & "'" & t2(c) & "'" Or zu & "' (" & s2(i2) & "'" & t2(c)
End If
Next
s2.RemoveAt(i2)
For i3 As Integer = 0 To s2.count - 1
For c As Integer = 0 To t2.count -1
Dim u As Integer = 0
Dim u1 As Integer = 0
For x As Integer = 1 To 100
If zu.lastindexof("(")> zu.indexof("(")
zu = zu.Substring(0,zu.lastindexof("("))
u = u + 1
End If
If zu.lastindexof("(") = zu.indexof("(") Then
Exit For
End If
If zu.lastindexof(")")> zu.indexof(")")
zu = zu.Substring(0,zu.lastindexof(")"))
u1 = u1 + 1
End If
If zu.lastindexof(")") = zu.indexof(")") Then
Exit For
End If
Next
If zu Like "(*" And (u + 1) Mod 2 = 0 And (u1 + 1) Mod 2 = 0 Then
zu = zu & s2(i2) & "'" & t2(c) & "'" Or zu & s2(i2) & "'" & t2(c) & "' ("
ElseIf zu Like "(*" And (u + 1) Mod 2 = 1 And (u1 + 1) Mod 2 = 0 Then
zu = zu & s2(i2) & "'" & t2(c) & "'" Or zu & s2(i2) & "'" & t2(c) & "' )"
End If
Next
s2.RemoveAt(i3)
Next
Next
DataTables("表A").StopRedraw
For Each dr As DataRow In DataTables("表A").DataRows
If CDbl(zu) = 2022 Then
dr = DataTables("表A").AddNew
dr("表达式") = zu
End If
Next
DataTables("表A").ResumeRedraw
Next