Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to prevent ItemCheck event from firing 1

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
0
0
US
If I have a CheckedListBox with an ItemCheck event defined, how do I set it to fire only if a user actually selects a checkbox item not when I check it programmatically.

Right now, if I programmatically set all the checkboxes, I will enter the event code 10 times if I have 10 checkbox items.

I don't want it to fire at all here.

But when the user selects a checkbox, then I want it to fire.

Thanks,

Tom
 
You can do something like this:

Code:
Private bolFireItemCheckEvent As Boolean

    Private Sub CheckedListBox1_ItemCheck(sender As Object, _
                e As ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck
        If bolFireItemCheckEvent Then[green]
            'Whatever code is needed here[/green]
        End If
    End Sub

And set this Boolean to True/False where you need it

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
That would work fine.

I was also looking at doing it by using the event handler, if possible. I know I can do:

event -= handler;

But I want to do it without actually knowing what the handler is.

Thanks,

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top