Changes

Hints and Recipes for VB6

626 bytes added, 19:23, 23 January 2008
The following lines were added (+) and removed (-):
 == Quickly determine which option button is selected ==Often OptionButton controls are arranged in control arrays. To quickly find the index of the only selected OptionButton control apply this little math trick.  The following example assumes there are 3 option buttons in a control array. intSelected = Option(0).Value * 0 - Option(1).Value * 1 - Option(2).Value * 2Note that the first operand is always zero, and you can simplify the above expression as follows: intSelected = -Option(1).Value - Option(2).Value * 2Credit to [http://msdnx.com/visual-basic-archive/23/43-36-236214.shtm Ed Lampman for this VB trick]. 
Bureaucrat, administrator
16,192
edits