VagabondSW Posted July 14, 2005 Posted July 14, 2005 I have a CheckedListBox that has some items already checked, while other items are not. This entire CheckedListBox should be Read Only. Unfortunately, the Locked property does not seem to produce that effect. Any ideas on locking the CheckedState of a CheckedListBox? Quote "Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
jmcilhinney Posted July 14, 2005 Posted July 14, 2005 Read up on the Locked property. It is design-time only and prevents a control being moved or resized by drag-and-drop in the designer. Private checkAllowed As Boolean = False Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck If Not Me.checkAllowed Then e.NewValue = e.CurrentValue End If End SubWhenever you want to check or uncheck an item programmatically, you have to set the checkAllowed variable to True first, and then back to False afterwards. Quote
VagabondSW Posted July 14, 2005 Author Posted July 14, 2005 Thanks! That does the trick quite nicely. Quote "Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.