老师们好!
窗口有好几个页面集合(tabcontrol)组成,窗口中的控件全是复选框(checkbox),数量也比较多,我在一个页面集合控件中设了一个“全选”控件(checkbox),并写了如下代码
Dim r As Row = Tables(e.form.TableName).Current
Dim s As String = e.Sender.Parent.name
For Each c As WinForm.Control In e.Form.Controls
If Typeof c Is WinForm.CheckBox Then
Dim t As WinForm.CheckBox = c
If t.Parent.name = s And t.name <> e.Sender.Name Then
Dim s1 As String = t.BindingField
Dim p1 As Integer = s1.LastIndexOf(".")
Dim c1 As String = s1.SubString(p1 + 1)
r(c1) = e.sender.Checked
End If
ElseIf Typeof c Is WinForm.GroupBox Then
Dim t As WinForm.GroupBox = c
For Each ctr As WinForm.Control In e.Form.Controls(t.Name).Children
If Typeof ctr Is WinForm.CheckBox Then
Dim t1 As WinForm.CheckBox = ctr
Dim s1 As String = t1.BindingField
Dim p1 As Integer = s1.LastIndexOf(".")
Dim c1 As String = s1.SubString(p1 + 1)
r(c1) = e.sender.Checked
End If
'Functions.Execute("全选遍历",Args(0),Args(1),Args(2),Args(3),Args(4))
Next
End If
Next
这个代码虽然管用, 能全选,但是对所有页面集合有效,我想要只能有效一个页面集合上控件的代码,请问怎样完成
此主题相关图片如下:111.png