Fire ItemCheck event from GUI only
Posted on 2005-03-25
I have a Sub that looks like this:
Private Sub CheckedListBoxAdd_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles CheckedListBoxAdd.ItemCheck
Dim i As Integer
If e.CurrentValue = CheckState.Indeterminate Then
Dim oRecord As myCLBData = CType(CheckedListBoxAdd.Items.Item(e.Index), myCLBData)
If CheckedListBox1.FindString(oRecord.Name.ToString) <> -1 Then
e.NewValue = CheckState.Indeterminate
e.NewValue = CheckState.Unchecked
This sub is used to check for the presence of a value in CLB-A when an item is checked in CLB-B. If found in CLB-A, it will not let you change the checkstate of CLB-B.
The problem I'm having is this event is firing if I check an item in CLB-A using the application, as well as when the state of a CLB item is changed programmically.
I want the event only to fire when using the GUI.
Can someone help with this?