老师你好:上列代码能获取多个列的c.Index 的值,但勾选的只有一个,麻烦老师指点一下,谢谢!
Dim clist As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
Dim t As Table = CurrentTable
For i As Integer = 0 To t.Cols.Count - 1
Dim c As Col = t.Cols(i)
Dim s1() As String
Dim pr As DataRow = DataTables("设置表默认字段不显示").sqlfind("表名='" & t.name & "'")
If pr IsNot Nothing Then
s1 = pr("默认不可显示列名").Split(",")
For Each r1 As String In s1
If c.name Like r1 Then
clist.SetItemChecked(c.Index, c.Visible)
MessageBox.Show(c.Index)
Else
clist.SetItemChecked(c.Index, Not c.Visible)
End If
''*********************************************
Next
End If
Next
Dim clist As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
Dim t As Table = CurrentTable
Dim pr As DataRow = DataTables("设置表默认字段不显示").sqlfind("表名='" & t.name & "'")
If pr IsNot Nothing Then
s1 = pr("默认不可显示列名").Split(",")
For i As Integer = 0 To clist.Items.Count - 1
Dim s As String = clist.Items(i).split("(")(0)
If Array.IndexOf(s1, s) > -1 Then
clist.SetItemChecked(i, t.Cols(r1).Visible)
MessageBox.Show(i)
Else
clist.SetItemChecked(i, False)
End If
Next
End If