逻辑列的排他式选择
假定表中有四个逻辑列,要求每行只能选中一个,例如选中选项A,会自动去掉选项B、选项C和选项D的选中标记。
此主题相关图片如下:以复选替单选之例.png
要实现此目的,只需将表的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
[此贴子已经被作者于2013-10-17 8:00:21编辑过]