Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling multiple frames with option buttons at runtime 1

Status
Not open for further replies.

MikeCt

Programmer
Nov 6, 2001
44
US
Hi
I know how to load controls at runtime, but now I would like to add a number of frames at runtime and then add (3) option buttons into each frame all at runtime. ( For each line of info on the form I need to select only 1 of 3 options )

Thanks
Mike
 

You have to Set the .Container of your added Option to the Frame this Option needs to be on.

Place Frame1 with index of 0 on the Form, and the option button with Index = 0 on the Form, and the Command1 command button, paste this code:
Code:
Option Explicit

Private Sub Command1_Click()

Load Frame1(1)
With Frame1(1)
    .Top = Frame1(0).Top + Frame1(0).Height
    .Left = Frame1(0).Left + Frame1(0).Width
    .Visible = True
End With

Load Option1(1)
With Option1(1)
    [blue]Set .Container = Frame1(1)[/blue]
    .Top = 200
    .Left = 100
    .Visible = True
End With

End Sub

Have fun.

---- Andy
 
If you want to have a variable number of line items, each containing, say, a title and three option buttons, another approach is to use the DataRepeater control. You can also store the resulting user choices directly to a database. This would solve the problem of not being able to fit more than a certain number of frames on the form, too, if such a problem you have.

 
Thank
Once again you gave me a clear and excellent solution
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top