Solved

Dynamic Objects

Posted on 1998-08-25
4
152 Views
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.
0
Comment
Question by:sb8gq
  • 2
4 Comments
 
LVL 1

Expert Comment

by:brunchey
Comment Utility
what code are you currently attempting to use to do this?  
how about...


Dim myfrm as new baseform

myfrm.show


0
 
LVL 1

Accepted Solution

by:
raygibbins earned 70 total points
Comment Utility
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

0
 
LVL 1

Expert Comment

by:raygibbins
Comment Utility
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
    myForm.Show
    SetParent Form2.Frame1.hWnd, myForm.hWnd
End Sub

0
 
LVL 1

Author Comment

by:sb8gq
Comment Utility
Thanks a lot
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to the message 13 62
VBA: retain first and second level based on "." 6 68
Window placement 17 64
DIR issue 7 46
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

10 Experts available now in Live!

Get 1:1 Help Now