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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create new frame in array

Status
Not open for further replies.

elibb

Programmer
Oct 22, 2001
335
MX
hi.. i have an array of frames, lets say of 3 elements, all frames look the same but they represent a different file.. how can i create a new element of the array at runtime, keeping all the elements is has inside??

thank you very much

Eli
 

the following example uses a frame (frame1) with a command button (command1), label (label1), and a text box (text1) with each of the controls (frame, text box, label, and command button) index set to 0 (zero).
[tt]
Option Explicit

Private Sub Form_Load()

'load the new controls
Load Frame1(1)
Load Command1(1)
Load Label1(1)
Load Text1(1)

'set the containers position
Frame1(1).Left = Frame1(0).Width + 30

'set up each of the controls so they are in the same position as the origional
Set Command1(1).Container = Frame1(1)
Command1(1).Left = Command1(0).Left
Command1(1).Top = Command1(0).Top
Command1(1).Visible = True

Set Label1(1).Container = Frame1(1)
Label1(1).Left = Label1(0).Left
Label1(1).Top = Label1(1).Top
Label1(1).Visible = True

Set Text1(1).Container = Frame1(1)
Text1(1).Left = Text1(0).Left
Text1(1).Top = Text1(0).Top
Text1(1).Visible = True

'show it all at once
Frame1(1).Visible = True

End Sub
[/tt]

You should put the frame1(0).left/top = 0 and make it large enough to hold each of these controls.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top