Re: How to lock CheckState in CheckedListBox? by Vagabond
Vagabond
Fri Jul 15 09:48:57 CDT 2005
"Shariq" <Shariq@discussions.microsoft.com> wrote in message
news:B030F19D-45FE-4C22-81F5-E60549FB21B8@microsoft.com...
> You could use the ItemCheck property of the CheckedListBox control
>
> Private Sub MyCheckList_ItemCheck(ByVal sender As Object, ByVal e As
> System.Windows.Forms.ItemCheckEventArgs) Handles lstLabelTypes.ItemCheck
> if e.CurrentValue=1 then
> e.NewValue=1
> end if
Thanks, that works with one caveat. The ItemCheck event fires even when
programmatically changing the CheckState. So, I also added a private bool
(checkStateLocked) that I could change when I want to alter the CheckState
programmatically. So the ItemCheck event block looks like this:
if (checkStateLocked) then
e.NewValue = e.CurrentValue;
Thanks again for your help.
Regards,
carl