逻辑列的排他式选择

假定表中有四个逻辑列,要求每行只能选中一个,例如选中选项A,会自动去掉选项B、选项C和选项D的选中标记。

要实现此目的,只需将表的DataColchanging事件代码设置为:

Select Case e.DataCol.Name
    Case
"选项A","选项B","选项C","选项D"
        If
e.NewValue = True Then
            Dim
nms() As String = {"选项A","选项B","选项C","选项D"}
           
For Each nm As String In nms
                If nm <> e.DataCol.Name AndAlso e.DataRow(nm) = True Then
                    e.DataRow(nm) = False
                End If
           
Next
        End If
End Select


本页地址:http://www.foxtable.com/webhelp/topics/2395.htm