Results 1 to 11 of 11

Thread: [RESOLVED] control array

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2012
    Posts
    7

    Resolved [RESOLVED] control array

    i have a program for control array for option buttons.The program creates a control array of 3 option buttons.The problem in my program is that out of 3 buttons,once selected the first button,even when i select the other buttons the first button does not get deselected..can any1 help me out

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: control array

    Welcome to the forums

    It works just fine for me....is the button that doesn't get deselected in a container (frame, picturebox, something like that)?

  3. #3
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: control array

    Sounds like you did not copy the option button and build the control array by saying "yes" to the prompt.
    Doctor Ed

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: control array

    It sounds to me like post #2 is on the right track. It does not matter what the name of the option button is nor if it is part of a control array it does matter what its parent container is. Only one option button can be selected within the given container so if you have 3 options in one frame and 3 options in another then one can be selected in each frame no matter how they are named or if they are part of 1 or more arrays or none.

    If you have 1 option in a frame and 2 options on the form then selecting an option on the form will no deselect the option in the frame as this would be considered as a seperate set of options due to the parent container.

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2012
    Posts
    7

    Re: control array

    I will be attaching the program.Check out and please help me to come out of this problem.1 more thing i noticed is that,it can have only 3 options buttons selected at a time.When i click on the fourth button,1 option button gets deselected
    Attached Files Attached Files

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: control array

    That is because you have 3 groups of options. only 1 per group can be selected.
    Options on the Form are 1 group
    Options in Frame1 are a group
    Options in Frame2 are a group

    Only one in each group can be selected so you have a max of 3

    If you want to be able to select more than one within a group then you must use checkboxes instead as option buttons are not designed for this. You can of course add additional groups by placing them in additional frames.

  7. #7
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: control array

    Your problem is that OptSoft(0) is not drawn within Frame1 (it looks as if it is but it's not). Highlight it in the IDE, select it and then Cut it, then select the Frame and select Paste. Position the Option Button appropriately and it will be OK

  8. #8

    Thread Starter
    New Member
    Join Date
    Aug 2012
    Posts
    7

    Re: control array

    @DataMiser:I totally agree on your point.But the program is working contradictrily.2 option button can be selected in a frame.
    when frame1 has already 2 buttons selected,and frame2 has 1.1 button from frame1 gets deselected automatically when i select the other option button in frame2.
    How can i make the program execute so that only 1 button gets selected in each frame.
    The problem is only in the first optio button of both the frames.
    @doogle:The same problem is in optDance(0) as well.I tried deleting thise option buttons,and repeated the same procedure.Still the problem is same.

  9. #9
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: control array

    Well, I cut and pasted 'Break Dance' into Frame2 and it behaves as expected

    EDIT: As a last resort you could programatically make sure
    Code:
    Private Sub Form_Load()
    Dim intI As Integer
    For intI = 0 To 2
        Set OptSoft(intI).Container = Frame1
        Set optDance(intI + 1).Container = Frame2
    Next intI
    End Sub
    BTW 'optDance(0)' doesn't exist in the code you posted earlier, only elements 1,2 & 3 (that's why there's '(intI + 1)' in the above.)
    Last edited by Doogle; Aug 16th, 2012 at 02:10 AM.

  10. #10
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: control array

    You have 2 option buttons that are on top of the frames but not inside them. Simply drag your frames to a different location and you will see which ones are not in the right place then you can cut and paste them into the frames and they will behave the way I told you. As is you have 3 groups 1 group on the form 1 group in 1 frame and 1 group in the other frame each group has 2 option buttons and since you think they are in the frames you are getting unexpected results yet they are working exactly how they are supposed to.

  11. #11

    Thread Starter
    New Member
    Join Date
    Aug 2012
    Posts
    7

    Re: control array

    @Data miser and @ doogle:Thank u.got your point.my problem is resolved.thank u

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