Bonjour à tous tout est dans le titre mais je suis un peu perdu pour savoir quel point d'entrée de mon programme il faut utiliser :
Pour l'instant mon application est un WindowsForm classique du démarre sur Form1.

j'ai un bout de code ci-dessous avec un sub main qui contient le code pour activer la console.
Dans les propriétés du Projet il y a un bouton "Afficher les événements de l'Application" qui fait apparaître une classe vide "MyApplication".

Comment configurer mon projet et quel objet de démarrage je dois choisir sachant que pour info je prévois aussi de rajouter un SplashScreen plus tard.

Je préfère vous demander avant de me lancer pour pas faire de bêtises.....je ne sais pas non plus à quoi correspond la class Program vis à vis de MyApplication (je sais pas si je suis clair...)

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
Imports System.Windows.Forms
Namespace FormWithConsole
    NotInheritable Class Program
        Private Sub New()
        End Sub
        ''' <summary>
        ''' The main entry point for the application.
        ''' </summary>
        <STAThread> _
        Private Shared Sub Main()
            Application.EnableVisualStyles()
            Application.SetCompatibleTextRenderingDefault(False)
#If DEBUG Then
            NativeMethods.AllocConsole()
            Console.WriteLine("Debug Console")
#End If
            Application.Run(New Form1())
#If DEBUG Then
            NativeMethods.FreeConsole()
#End If
        End Sub
    End Class
End Namespace
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
Namespace FormWithConsole
    Friend NotInheritable Class NativeMethods
        Private Sub New()
        End Sub
        ' http://msdn.microsoft.com/en-us/library/ms681944(VS.85).aspx
        ''' <summary>
        ''' Allocates a new console for the calling process.
        ''' </summary>
        ''' <returns>nonzero if the function succeeds; otherwise, zero.</returns>
        ''' <remarks>
        ''' A process can be associated with only one console,
        ''' so the function fails if the calling process already has a console.
        ''' </remarks>
        <DllImport("kernel32.dll", SetLastError:=True)> _
        Friend Shared Function AllocConsole() As Integer
        End Function
 
        ' http://msdn.microsoft.com/en-us/library/ms683150(VS.85).aspx
        ''' <summary>
        ''' Detaches the calling process from its console.
        ''' </summary>
        ''' <returns>nonzero if the function succeeds; otherwise, zero.</returns>
        ''' <remarks>
        ''' If the calling process is not already attached to a console,
        ''' the error code returned is ERROR_INVALID_PARAMETER (87).
        ''' </remarks>
        <DllImport("kernel32.dll", SetLastError:=True)> _
        Friend Shared Function FreeConsole() As Integer
        End Function
    End Class
End Namespace