以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]contains报错  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=176655)

--  作者:chnfo
--  发布时间:2022/4/21 17:05:00
--  [求助]contains报错
自己设置了一个DropDownForm类型的窗口
DropDownOpened事件中:

Dim r As Row = Tables("年级课程").Current
Dim t As Table = e.Form.Controls("Table1").Table
If r IsNot Nothing Then
    t.filter = "年级 = \'" & r("年级") & "\'"
Else
    t.Filter = "false"
End If

Dim y As Row = Tables("年级课程.学生").Current
If y IsNot Nothing AndAlso y.IsNull("选修课") = False Then
    Dim a As String() = y("选修课").split(",")
    For Each x As Row In t.Rows
        x.Checked = a.Contains(x("课程"))
    Next
End If


保存的时候提示
编译错误:“Contains”不是“System.Array”的成员。
错误代码:x.Checked = a.Contains(x("课程"))


--  作者:有点蓝
--  发布时间:2022/4/21 17:09:00
--  
数组不能使用Contains。要使用IndexOf

x.Checked =Array.Indexof(a, x("课程")) > -1