Home All Groups Group Topic Archive Search About

How to dynamically add controls into a frame?

Author
2 Feb 2006 4:41 PM
Andrew
Hello, guys,

Just wonder how to dynamically add controls into a frame, any reference
paper, sample source code? Thanks.

Author
2 Feb 2006 5:34 PM
J French
On Thu, 2 Feb 2006 08:41:42 -0800, =?Utf-8?B?QW5kcmV3?=
<And***@discussions.microsoft.com> wrote:

>Hello, guys,
>
>Just wonder how to dynamically add controls into a frame, any reference
>paper, sample source code? Thanks.

If you use Control Arrays then :-

Option Explicit

' Add 1 Textbox
' Set its Index property = 1
' Stick a Frame and
' Commandbutton on the Form

Private Sub Command1_Click()
   Dim L9&, V&

   V = 300
   For L9 = 1 To 5
       Load Text1(L9)
       Set Text1(L9).Container = Frame1
       Text1(L9).Top = V
       V = V + Text1(L9).Height
       Text1(L9).Visible = True
   Next

End Sub