Results 1 to 6 of 6

Thread: VB - Quickly determine which option button is selected

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Ed Lampman's Avatar
    Join Date
    Mar 2001
    Posts
    273

    VB - 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 you
    can use the following code:

    Code:
    ' assumes that the control array contains 
    three OptionButton controls
    intSelected = Option(0).Value * 0 - Option(1).Value * 1 - Option(2).Value * 2
    Note that the first operand is always zero,
    and you can simplify the above expression as follows:
    intSelected = -Option(1).Value - Option(2).Value * 2
    Last edited by Ed Lampman; Mar 18th, 2003 at 09:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width