Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Check box control event events

Posted on 2004-12-01
Medium Priority
Last Modified: 2010-04-24
Hell .net experts,

I am having some trouble with handling events in little app I'm developing.  I've not used .net before so this is all new to me.

I have a form with a ViewTree in which the user can select various nodes.  As the user browses through the nodes, details about the currently selected node are displayed on the form.  One of the values these nodes have is a boolean that I represent as a CheckBox.  The user is allowed to change this value by checking or unchecking the box which then changes the underlying value in the node object.

The event I'm using to handle this is CheckChanged, and it works ok if I just check and uncheck on a single node.  My problem is that the CheckChanged event is also triggered when a user selects a node which has a different check status than the previous.  In this case I dont want anything to happen, I understand why it's being triggered because, of course, the check box value has changed.  But it has been changed because we are now looking at a different node, not because the user is trying to change the current node's status.

Anyone got any ideas on how to get around this?  Are there other more appropriate events I could use?

Thanks for any input.

Question by:TommyV10
LVL 96

Expert Comment

by:Bob Learned
ID: 12716469
More appropriate events for detecting a user change versus a program change is to use the MouseDown (left-click) and KeyDown (space bar) events.

LVL 27

Expert Comment

ID: 12716613

Here is where I found good examples for getting started in VB.Net


Link for ASP programs...


Accepted Solution

cmellon earned 1500 total points
ID: 12719063
Hi Tommy,

Can;t think of another event to fire instead, but the only work around is to have a loading flag.


have a private variable boolean variable that is set to false.

dim mbLoading as boolean = false

Then when you set the checkbox value in code, set mbloading = true and then set it back to false after setting it.


' Load data
mbLoading = True
checkbox1.checked = {Value}
mbLoading  = false

Then in your CheckChanged event put your code that runs inside an if statement.

If mbloading = false then
   ' Do your stuff
End If

That will get round the problem, can;t think of any other way.



Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question