Bonjour,
J'ai essayé avec ce code, mais ça marche pas. En fait, j'ai trouvé une solution sur le forum; c'est la traduction de VB6 vers VB .NET
Voici le code :'A placer avant InitializeComponent()
If
m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'For the start-up form, the first instance created is the default instance.
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
#Region "Upgrade Support form VB6"
' Attention à Form1 remplacer par le nom de votre feuille
Private Shared m_vb6FormDefInstance As Form2
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As Form2
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New Form2
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set(ByVal Value As Form2)
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
N. B. : Form2 est la feuille fille
Y a-t-il une autre solution sans de traduire de VB6 vers VB .NET ???
OmarIX