1、 CheckedListBox并不能直接与DataSet进行绑定,因此在绑定前做一些处理:
Dim CheckedListBoxItems As New ArrayList()
For Each dr As DataRow In Me.dataset.Tables(0).Rows
CheckedListBoxItems .Add(dr("test"))
Next
Me.CheckedListBox1.DataSource = CheckedListBoxItems
2、根据条件设定默认的勾选项
If (condition1=condition2) Then
Me.CheckedListBox1.SetItemChecked(i, True)
End If
3、当对CheckedListBox中默认选择项进行操作时,做一些处理让其一直处于checked状态,用户所看到的就是无法对其进行操作
Private Sub CheckedListBox1_ItemCheck(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck
If e.NewValue = CheckState.Unchecked Then
If (condition1=condition2) Then
e.NewValue = CheckState.Checked
End If
End If
End Sub
原文:http://blog.csdn.com/wangpeixian/article/details/4417260
1401



被折叠的 条评论
为什么被折叠?



