Toggling Checkboxes

Category:
Forms and Controls
Type:
Snippets
Difficulty:
Beginning
Author:
Anonymous

Version Compatibility: Visual Basic 6

More information:
Using checkboxes to simulate behavior of option buttons. Sometimes one might want to use checkboxes instead of option buttons on the input screen just so it maintains the looks of the actual input form. For example, on an actual input form, it may require an applicant to check only one of the three checkboxes provided. Here's where an array of checkboxes can be used in lieu of an array of option buttons. All you need to do is call the routine in the checkbox's click event passing the index and the name of the checkbox array, and it will automatically uncheck the previous checkbox and check the current checkbox for you.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: