Bonjour

J'ai un projet multi-documents qui se lance a partir

Le programme commence par un splashscreen qui se lance a partir de la MainForm(MdiParent).

Classe program

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
Imports System.Threading
 
Namespace SplashScreenThreaded
	Friend NotInheritable Class Program
 
		Private Sub New()
		End Sub
 
		''' <summary>
        ''' Le point d'entrée principal de l'application.
		''' </summary>
		<STAThread> _
		Shared Sub Main()
			Application.EnableVisualStyles()
			Application.SetCompatibleTextRenderingDefault(False)
			Application.Run(New MainForm())
		End Sub
	End Class
End Namespace
Ensuite j'ai mon formulaire Parent avec lequel je lance les formulaires child tout se passe bien :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
 
Imports System.ComponentModel
Imports System.Text
Imports System.Threading
Imports Oracle.DataAccess.Client
 
Namespace SplashScreenThreaded
    Public Class MainForm
        Inherits Form
 
        Public sf As New SplashScreenForm()
 
        Public Sub New()
            Me.Hide()
            Dim splashthread As New Thread(New ThreadStart(AddressOf SplashScreen.ShowSplashScreen))
            splashthread.IsBackground = True
            splashthread.Start()
            InitializeComponent()
        End Sub
        'MISE A JOUR DES STATUT CANDIDATURE + SUPPRESSION DES CANDIDATS 
        '***************************************************************
 
#Region "#########EVENEMENT DU FORMULAIRE MainForm#########"
        Public Sub MainForm_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
 
            SplashScreen.UdpateStatusText("Chargement du programme")
            Thread.Sleep(1000)
            SplashScreen.UdpateStatusTextWithStatus("Connexion à la base de données", TypeOfMessage.Success)
            Thread.Sleep(1000)
 
            Try
                conn.Open()
                SplashScreen.UdpateStatusTextWithStatus("Connexion réussie.", TypeOfMessage.Success)
                Thread.Sleep(5000)
                SplashScreen.UdpateStatusTextWithStatus("Mise à jour des statuts des candidatures.", TypeOfMessage.Success)
                Call PROC_MAJ_STATUT_CANDIDATURE()
                Thread.Sleep(2000)
                Me.Show()
                SplashScreen.CloseSplashScreen()
                Me.Activate()
                NotifyIcon1.Icon = My.Resources.Boss
                Me.WindowState = FormWindowState.Maximized
            Catch ex As OracleException ' intercepte seulement les erreurs Oracle
                Select Case ex.Number
                    Case 12545
                        SplashScreen.UdpateStatusTextWithStatus("La Base de Données n'est pas disponible." & Chr(13) & ex.Message.ToString(), TypeOfMessage.Error)
                        Thread.Sleep(5000)
                        SplashScreen.CloseSplashScreen()
                        drapFermMain = True
                        Me.Close()
                    Case Else
                        SplashScreen.UdpateStatusTextWithStatus("Erreur de Base de Données :" & Chr(13) & ex.Message.ToString(), TypeOfMessage.Error)
                        Thread.Sleep(5000)
                        SplashScreen.CloseSplashScreen()
                        drapFermMain = True
                        Me.Close()
                End Select
            Catch ex As Exception ' intercepte toutes les erreurs
                SplashScreen.UdpateStatusTextWithStatus("Erreur dans le chargement du formulaire principal : " & Chr(13) & ex.Message.ToString(), TypeOfMessage.Error)
                Thread.Sleep(2000)
                drapFermMain = True
                Me.Close()
                SplashScreen.CloseSplashScreen()
            End Try
 
        End Sub
        Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            If drapFermMain = False Then
                If MessageBox.Show("Etes-vous sur de vouloir fermer l'application?", "Quitter", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
                    e.Cancel = False
                Else
                    e.Cancel = True
                End If
            End If
        End Sub
        ''' FERMETURE DU FORMULAIRE
        Private Sub FormClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitterLapplicationToolStripMenuItem.Click
            Me.Close()
        End Sub
        ''' AFFICHE LA FORM: FrmAboutBox
        Private Sub ÀproposDeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ÀproposDeToolStripMenuItem.Click
            mdiChildApropos.ShowDialog()
        End Sub ''' AFFICHE LA FORM: FRMNOUVCANDIDAT
        Public Sub NouveauCandidatToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NouveauCandidatToolStripMenuItem.Click
 
            '//test si la mdi est déjà affichée
            If mdiChildAjout.Text = "Ajout d'un nouveau candidat." Or Mid(mdiChildAjout.Text, 1, 22) = "Modification candidat:" Then
                MsgBox("Une fenêtre pour cette fonction du programme existe déjà " & Chr(13) _
                  & "Veuillez fermer la fenêtre déjà active pour pouvoir en ouvrir un nouvelle .", vbExclamation, "Attention !")
                Exit Sub
            End If
 
            mdiChildAjout = New FrmNouvCandidat
            mdiChildAjout.Text = "Ajout d'un nouveau candidat."
            mdiChildAjout.MdiParent = Me
            MsgBox(mdiChildAjout.MdiParent)
            mdiChildAjout.Show()
            mdiChildAjout.TXT_NOM.Focus()
            OptionToolStripMenuItem.Enabled = False
 
 
        End Sub
 
#Region "#########AFFICHE LES MDI###########"
        ''' RECHERCHE DE CANDIDAT FILTRE
        Public Sub RechercherToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RechercherToolStripMenuItem.Click
            Try
                '//test si la mdi est déjà affichée
                If mdiChildRech.Text = "Recherche de candidatures" Then
                    MsgBox("Une fenêtre pour cette fonction du programme existe déjà " & Chr(13) _
                      & "Veuillez fermer la fenêtre déjà active pour pouvoir en ouvrir un nouvelle .", vbExclamation, "Attention !")
                    Exit Sub
                End If
 
                mdiChildRech = New FrmRecherche
                mdiChildRech.Text = "Recherche de candidatures"
                mdiChildRech.MdiParent = Me
                mdiChildRech.Show()
                mdiChildRech.TXT_NOM.Focus()
            Catch obj_erreur As Exception
                MsgBox("Erreur dans RechercherToolStripMenuItem_Click de la FrmMain: " & obj_erreur.Message)
 
            End Try
 
 
        End Sub
 
        ''' ECRAN POUR AJOUTER UN PROFIL
        Private Sub AjoutDunprofilToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AjoutDunprofilToolStripMenuItem.Click
            Try
                '//test si la mdi est déjà affichée
                If mdiChildProfil.Text = "Profil candidat" Then
                    MsgBox("Une fenêtre pour cette fonction du programme existe déjà " & Chr(13) _
                      & "Veuillez fermer la fenêtre déjà active pour pouvoir en ouvrir un nouvelle .", vbExclamation, "Attention !")
                    Exit Sub
                End If
 
                mdiChildProfil = New FrmProfil
                mdiChildProfil.Text = "Profil candidat"
                mdiChildProfil.MdiParent = Me
                mdiChildProfil.Show()
            Catch obj_erreur As Exception
                MsgBox("Erreur dans AjoutDunprofilToolStripMenuItem_Click de la FrmMain: " & obj_erreur.Message)
            End Try
 
        End Sub
        ''' ECRAN POUR AJOUTER UN POSTE
        Private Sub PosteVacantToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PosteVacantToolStripMenuItem.Click
            Try
                '//test si la mdi est déjà affichée
                If mdiChildPoste.Text = "Postes vacants" Then
                    MsgBox("Une fenêtre pour cette fonction du programme existe déjà " & Chr(13) _
                      & "Veuillez fermer la fenêtre déjà active pour pouvoir en ouvrir un nouvelle .", vbExclamation, "Attention !")
                    Exit Sub
                End If
 
                mdiChildPoste = New FrmPoste
                mdiChildPoste.Text = "Postes vacants"
                mdiChildPoste.MdiParent = Me
                mdiChildPoste.Show()
            Catch obj_erreur As Exception
                MsgBox("Erreur dans PosteVacantToolStripMenuItem_Click de la FrmMain: " & obj_erreur.Message)
            End Try
 
        End Sub
#End Region
    End Class
End Namespace
Quand je suis dans le formulaire child mdiChilRecherche je voudrais lancer le formulaire mdiChildAjout mais sans succès:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
mdiChildAjout = New FrmNouvCandidat
mdiChildAjout.MdiParent = MainFrom
mdiChildAjout.Show()
J'ai une erreur sur la ligne mdiChildAjout.MdiParent = MainFrom

Erreur: inaccessible en raison de son niveau de protection.
J'ai regardé au niveau des protections (public) mais je ne vois rien .

Auriez vous une idée car la je ne vois pas.

D'avance merci