Bonjour à tous,

Je suis débutant en VB.net, voici mon programme ci-dessous.
J'ai une erreur au niveau de la condition while, je voudrais que ce qu'il y a dans la boucle while s'effectue à chaque fois que l'utilisateur appuie sur le bouttonP de la Form4 or je ne vois pas comment faire même en cherchant sur les tutoriels.

Merci d'avance pour votre aide.


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
 Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
        Dim x As Integer = 10
        While Form4.ButtonP.Click
            If Form4.TextBoxbranche1.Text = "" Then
            Else
                e.Graphics.DrawLine(Pens.Red, x, 40, x + 90, 40)
                e.Graphics.DrawString(Form4.TextBoxbranche1.Text, Font, Brushes.Black, 40, 27)
            End If
 
            If Form4.TextBoxbranche2.Text = "" Then
            Else
                e.Graphics.DrawLine(Pens.Red, x, 80, x + 90, 40)
                e.Graphics.DrawString(Form4.TextBoxbranche2.Text, Font, Brushes.Black, 45, 65)
            End If
            If Form4.TextBoxBranche3.Text = "" Then
            Else
                e.Graphics.DrawLine(Pens.Red, x, 0, x + 90, 40)
                e.Graphics.DrawString(Form4.TextBoxBranche3.Text, Font, Brushes.Black, 45, 3)
            End If
            x = x + 90
        End While
    End Sub