Radio Buttons & Check Boxes
The event generated when the user interacts with these controls is not a click event as it is when the user interacts with a button, but a CheckChanged event. This is because when the user clicks on these controls, they intend to change the current status of the control. A problem occurs when a beginning programmer, or one new to VB, assumes that a click means the user is selecting (turning on) that option. It is actually just as likely that the user is deselecting or turning off that option.
Think about the operation of a Check Box compared to a Radio Buttons. Check boxes have to be deselected by the program user whereas Radio Buttons are automatically deselected for the user when they click on a different radio button.
So, does clicking turn the check on or does it turn the check off? Truthfully it can do either one. If the check is currently on then clicking it will turn the check off and vica versa. This is precisely the reason why the procedure is named CheckChanged. It is changing the check from its current state to the opposite state. Radio buttons and Check boxes are controls which alter the state of something in a program. Buttons are controls which activate an event procedure. If a programmer forgets that the Radio button and Check box event is CheckChanged, their coding will generate peculiar and unreliable results. Here is a program you can download which demonstrates this behaviour.
The most important effect of this, is that when we code using these controls, we must not assume that the user event is turning the state of the control on, rather it is changing the state of the control. It might be turning the control off. The easiest way to cope with this ambiguity when coding is to always use a Forced Choice selection structure. Explicitly check the state of the control by testing the Checked property of the control. Then provide one set of commands to be executed if the control is being selected, and another set of cammands to be executed if the control is being deselected. This way we can code the event to respond appropriately whether it is turned on or whether it is turned off. Typical code would look like this:
If EmailOptIn.Checked then
optIn = True
optIn = False
This is better code - more reliable - than using just a conditional and incorrectly assuming that the user is always turning the control on. Making assumptions about the state of controls in programming always causes problems sooner or later.
Solving People ProblemsActually this article is not about solving people’s problems, it is about how to get people to do what you want them to do. The simplest context is that of working in a business, but the process is also applicable to personal situations. The central issue is how do you get someone to do what you want done? There is a rational process for doing this. It does require their cooperation, but assuming you have a common objective this is posible and does not have to invole blackmail or any other illeagal or immoral activity.
The BasicsGiven a situation in which someone did not do what you wanted them to do, how do you get them to change their behaviour so they will do what you want rather than repeat the undesireable behaviour. If someone does not do as you want them to do, there are only two possible reasons for their behaviour.
First: they cannot do what you want them to do because they lack the ability to do it.
The first is an ability problem. They literally can not do what you want them to do. A quick example should help qualify this situation. If you are confronted by a robber who holds a gun to your head and demands that you give them a $100 bill. In this situation most of us want to do as the robber demands. We want to live! We are motivated! If we do not have the required bill giving the robber one hundred dollars will not do—he wants a one hundred dollar bill. Assuming you do not carry one hundred dollar bills on your person, this is an ability problem, No matter how much we want to do it we cannot because we do not have the demanded banknote.
Second: they want to do something else because they lack motivation to do what you want done.
The second situation is a direct clash of our desires and their desires. Here we must point out that you can only negotiate this situation if you do indeed have a common objective. We need to jointly examine the consequences of performing or not performing the desired behaviour. One person’s wants will prevail in this situation. In other words we will have a consequence off to determine whose wants will become uppermost. We want to motivate the other person to do what we want done.
CommunicateSo our first action in our hypothetical situation mentioned above is to find out why the other person did what they did. We need information from them to understand which of the two possble reasons explain their behaviour. They we can determine what course of action we need to follow to change their behaviour.
However, two common obstacles commonly arise at this point. Let me illustrate with a couple short examples. Let us say an employee was late for work one morning and their supervisor catches up with them later that morning. What does the supervisor say?
"That was a bonehead move you pulled this morning!"
The employee now has to interpret this comment and respond. Several thoughts and responses are possible:
- What did I do? There is uncertainty because the supervisor did not spell out the topic of discussion. Lack of specificity is hampering the communication. Some supervisors actually do this deliberately with the mistaken idea that a fishing expedition is good policy because it might turn up something they did not previously know about. In the long term baiting employees in this manner only causes them to clam up and say the minimum possible. The less that is said the harder time we have determining whether their problem is an ability problem or a motivation problem.
- What does he know about? This is one step more paranoid than the above and also reduces the quantity and quality of the communication. Again we have determining whether their problem is an ability problem or a motivation problem.
- Bonehead move? who does she think she is?’ This is the other main problem because now the employee will become defensive. How much communication takes place when we are defensive?
"Bill you were fifteen minutes late for work this morning, Help me understand what happened."
This is specific. Bill knows exactly what his supervisor is asking of him. It also invites Bill to share information rather than judging him or threatening him. The very fact that his supervisor brings it up also tells him that it matters and that he should not be late. Whatever Bill's reason for being late, the supervisor has invited a response and has not threatened him. Naturally, to be effective this message must be consistent in words, as well as in tone of voice and in non-verbal behaviour.