OVH Cloud OVH Cloud

une forme à l'intérieur d'une autre

1 réponse
Avatar
Yang Li Ke
Bonjour à tous,

Est-il possible d'ouvrir plusieurs instances d'une form à l'intérieur d'une
même forme principale en utilisant ce genre de code:

Dim oForm As Form1
Set oForm = New Form1
Call oForm.Show
Set oForm = Nothing
--
Merci !!!

Yang

1 réponse

Avatar
ng
Salut,

Je vois deux solutions :

1/ Utiliser une feuille MDI et définir Form1 en tant que MDIChild (MDIChild
= True)

2/ Utiliser SetParent (Ici Form1 contiendra Form2) :
Dans Form1 :

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

Private Sub Command1_Click()
Dim oForm As Form2
Set oForm = New Form2
Call SetParent(oForm.hWnd, Me.hWnd)
Call oForm.Show
Set oForm = Nothing
End Sub


--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/


"Yang Li Ke" a écrit dans le message de news:
IAiXb.12391$
Bonjour à tous,

Est-il possible d'ouvrir plusieurs instances d'une form à l'intérieur


d'une
même forme principale en utilisant ce genre de code:

Dim oForm As Form1
Set oForm = New Form1
Call oForm.Show
Set oForm = Nothing
--
Merci !!!

Yang