窗口有3个CheckBox控件,已经绑定到列,按帮助中“复选框排他式选择”范例,将表的DataColchanging事件代码设置为下:
Select Case
e.DataCol.Name
Case "选项A","选项B","选项C"
If
e.NewValue = True Then
Dim nms() As String = {"选项A","选项B","选项C"}
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
如果直接从表里面操作,确实能达到排他性效果。但从窗口操作时,发现了问题,居然可以选择两个!也就是说只能排除一个。
如图:
此主题相关图片如下:clip_4.jpg
![dvubb 图片点击可在新窗口打开查看](UploadFile/2014-3/20143172395030103.jpg)
不知何故?