swap a controls container at runtime

Posted on 2006-05-03
Last Modified: 2010-04-07
I have a frame (frame 'child') (with controls nested in it). This frame is itself contained in another Frame (Frame 'A').
Now, based on the user preferences I wish to move the frame (frame 'child') to another container frame ('frame B').

So, how would I do this?
Question by:mccainz2
    LVL 5

    Author Comment


    Here is the txt from a form file that illustrates the concept.... and why it isnt working as intended

    VERSION 5.00
    Begin VB.Form Form1
       Caption         =   "Form1"
       ClientHeight    =   3165
       ClientLeft      =   60
       ClientTop       =   375
       ClientWidth     =   4635
       LinkTopic       =   "Form1"
       ScaleHeight     =   3165
       ScaleWidth      =   4635
       StartUpPosition =   3  'Windows Default
       Begin VB.Frame Frame1
          Caption         =   "Frame1"
          Height          =   2985
          Left            =   60
          TabIndex        =   0
          Top             =   60
          Width           =   4515
          Begin VB.Frame Frame2
             Caption         =   "Frame2"
             Height          =   1125
             Left            =   180
             TabIndex        =   2
             Top             =   270
             Width           =   1695
          Begin VB.Frame Frame3
             Caption         =   "Frame3"
             Height          =   1545
             Left            =   2130
             TabIndex        =   1
             Top             =   330
             Width           =   2325
             Begin VB.Frame Frame5
                Caption         =   "Frame5"
                Height          =   825
                Left            =   690
                TabIndex        =   4
                Top             =   180
                Width           =   1515
                Begin VB.CommandButton Command1
                   Caption         =   "Command1"
                   Height          =   315
                   Left            =   330
                   TabIndex        =   5
                   Top             =   330
                   Width           =   1035
          Begin VB.Frame Frame4
             Caption         =   "Frame4"
             Height          =   1215
             Left            =   390
             TabIndex        =   3
             Top             =   1560
             Width           =   1605
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False

    Private Sub Command1_Click()

        Frame5.Container = Frame2
    End Sub

    LVL 26

    Accepted Solution


    set Frame5.Container = Frame2

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now