Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleCreate a new control using Load and put it in a Frame
DescriptionThis example shows how to create a new control and put it in a Frame in Visual Basic 6. The program uses Load to create the new control and then sets its Container property to the Frame control.
KeywordsControls.Add, new control, Frame
CategoriesControls, Tips and Tricks
 
Create the control using Load. Set its Container property to the Frame.
 
Private Sub Command1_Click(Index As Integer)
Dim new_index As Integer
Dim i As Integer
Dim max_top As Single

    new_index = Option1.UBound + 1
    Load Option1(new_index)

    ' Put the new button inside the right frame.
    Set Option1(new_index).Container = Frame1(Index)

    ' Find the largest Top value in this frame.
    For i = 0 To new_index - 1
        If Option1(i).Container Is Frame1(Index) Then
            If max_top < Option1(i).Top Then max_top = _
                Option1(i).Top
        End If
    Next i

    ' Position the new control.
    Option1(new_index).Top = max_top + _
        Option1(new_index).Height

    ' Make the control visible.
    Option1(new_index).Visible = True
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated