Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


How to prevent ItemCheck event from firing

How to prevent ItemCheck event from firing

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.



RE: How to prevent ItemCheck event from firing

You can do something like this:


Private bolFireItemCheckEvent As Boolean

    Private Sub CheckedListBox1_ItemCheck(sender As Object, _
                e As ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck
        If bolFireItemCheckEvent Then
            'Whatever code is needed here
        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.

RE: How to prevent ItemCheck event from firing

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.



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close