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
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.
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
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.
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
@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.
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.
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.