Results 1 to 5 of 5

Thread: Option -- which opt was selected?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303
    Hi all,

    I placed the option1 in my form, and copied the option1
    5 times. Which is now option1(0) option1(4). However,
    when the user clicks on any of the option1(0-4), can I
    tell which index was selected/clicked?

    I don't want to check option1(0).value - option1(4).value
    to see which one was selected, but if that is the only way,
    please let me know.

    Thanks

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    option1(index)
    the index is passed as an integer to the Option1_Click() sub
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    optTest_click

    I just created a control Array of Options named "optTest." VB creaated the following Subroutine.
    Code:
    Private Sub optTest_Click(Index As Integer)
    
    'In this Sub, Index will have a value of 0, 1, 2 ... 
    'depending on which option was clicked
    
    End Sub
    I hope the above helps.

    You should not use VB default names. Rename your controls, text boxes, et cetera to something meaningful to you.

    I usually use the first three or four characters to indicate what the object is.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    A.K.A. - Hungarian Notation
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Another thot.

    After making my previous post, it occurred to me that perhaps you should not be using a control array for your options. Why not give each a different name?

    For example, I have a gravitational computation application which allows for 3 different coordinate systems. My Options are named optCartesian, optCylindrical, & optSpherical. VB created 3 subroutines: optCartesian_Click, optCylnidrical_Click, & optSpherical_Click.

    If you have more than one set of options, you can put each set on a different frame.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

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