Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionIf maForme(Index) Is Nothing Then ' Existe pô encore Else ' Existe déjà End If
Private Sub Command1_Click()Tu n'as à ce stade pas chargé Form2, n'est-ce-pas ? Et pourtant Form2 n'est pas nothing
If Form2 Is Nothing Then MsgBox "oui" Else MsgBox "non"
End Sub
Private Sub Command1_Click()
MsgBox form_existe(Form2) ' t'affichera false
Load Form2
DoEvents
MsgBox form_existe(Form2) ' t'affichera maintenant True
End Sub
Private Function form_existe(f As Form) As Boolean
Dim f1 As Form
For Each f1 In Forms
If f1 Is f Then
form_existe = True
Exit For
End If
Next
End Function
Private Sub Programme_Click(Index As Integer)
Dim frm As Form
For Each frm In Forms
If frm Is Prgm(Index) Then
Prgm(Index).SetFocus
Exit Sub
Next
Load Prgm(Index)
If frm = Prgm(Index) Then Exit Subil fallait seulement remplacer le signe = par "is" !
Tout seul, hein ...? <mode spécial> CHAPEAU BAS ! </fin mode spécial>