-
Dec 15th, 1999, 04:55 PM
#1
Thread Starter
Member
Hi,
Is it possible to
Creates a new form during run time, and then copy objects over from an existing form onto the new form?
Thanks.
-
Dec 15th, 1999, 07:18 PM
#2
If you add an empty form to your project you can instanciate that form several times:
Private Sub CreateForm()
Dim frmNew As frmEmpty 'frmEmpty = the name of your empty form
Set frmNew = New frmEmpty
frmNew.Show
End Sub
You can MOVE controls from one form to an other using the SetParent API. There's a workaround here however if the control you want to copy is in a control array. Here's an example that moves a textbox from one form to the new when you click Command1:
Private Declare Function SetParent _
Lib "user32" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Private Sub Command1_Click()
Dim frmNew As frmEmpty
Dim iIndex%
Set frmNew = New frmEmpty
iIndex = Text1.Count
Load Text1(iIndex)
Text1(iIndex).Visible = True
frmNew.Show
Call SetParent(Text1(iIndex).hWnd, frmNew.hWnd)
End Sub
Good luck!
[This message has been edited by Joacim Andersson (edited 12-16-1999).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|