Dynamic Objects

Posted on 1998-08-25
Last Modified: 2012-05-04
I have 2 Forms. One of which contains a control array of frames... I wish to be able to Create new instances of the other form dynamically, selecting one of the panels from the other form, and having that on the new form.
Question by:sb8gq
  • 2

Expert Comment

ID: 1430911
what code are you currently attempting to use to do this?  
how about...

Dim myfrm as new baseform


Accepted Solution

raygibbins earned 70 total points
ID: 1430912
Stick this declaration into a module

Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

I used 2 forms - Form1 and Form2
Form 2 had Frame1 on it

In the form1_load event, the following code
    Dim myForm As Form1
    SetParent Form2.Frame1.hWnd, Form1.hWnd


Expert Comment

ID: 1430913
Re previous answer

The following code is more what you need I think

Private Sub Form_Click()
    Dim myForm As Form1
    Set myForm = New Form1
    SetParent Form2.Frame1.hWnd, myForm.hWnd
End Sub


Author Comment

ID: 1430914
Thanks a lot

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel VBA combine two working workbooks 8 49
How does CurrentUser work? 10 31
Notepad++ how to remove delimiter : from beggning of the line? 3 94
Hide vba in gp 7 83
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

22 Experts available now in Live!

Get 1:1 Help Now