I just reread your post, NobodysPerfect, and notice you have the same objection to this that occurred to me:
Quote:
|
Originally Posted by NobodysPerfect
I'd have to change each Private _Click sub if (for what ever reason) I have to rename my check boxes.
|
Well, almost the same. Doing it your way or mine (either one) would keep us from having to change the call when a control name changed. But we'd still have to change the evaluation in DoWithBox.
With the knowledge I have now I can't be sure what the idea approach would be. The general principle would be to keep the parts that vary with the checkbox
in the checkbox, and make DoWithBox act the same way for every caller...if possible, of course. For instance, if we wanted to generate a different message for each selection (probably not the case here), then each selection should pass the message rather than the checkbox name:
Code:
Private Sub CB1a_Click
DoWithBox "For question 1 you chose answer a."
End Sub
Sub DoWithBox(msg)
MsgBox msg
.
.
.
End Sub
But that's just a principle; depending on what's needed, it may not be practicable.