Bonjour tout le monde,

J'ai un problème dans la suppression de ligne dans ma listbox "Listparois"

Pour remplir ma listbox, j'utilise le code suivant:

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
Private Sub ajout_mur_Click()
 
Listparois.AddItem TextBox1.Value, ListCount
 
Listparois.List(Listparois.ListCount - 1, 1) = TextBox2.Value * TextBox3.Value
 
If TextBox4.Visible = True Then
    Listparois.List(Listparois.ListCount - 1, 2) = TextBox4.Value
Else
    Listparois.List(Listparois.ListCount - 1, 2) = "T ext"
End If
 
new_paroi.Enabled = False
new_paroi.Visible = False
 
End Sub
Et pour supprimer une ligne que l'utilisatzeur aurait pu remplir accidentelement, j'ai essayé avec le code ci dessous :

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
Private Sub supprparoi_Click()
 
Dim i As Integer, mo As Single
 
mo = -1
While Listparois.Value(mo + 1) <> ""    ''''''Listparois est une Listbox'''
    mo = mo + 1
Wend
 
If mo <> -1 Then
    For i = 0 To mo
        If Listparois.Selected(i) = True Then
            Listparois.RemoveItem i
        End If
    Next
Else
    MsgBox ("il n'y a rien a supprimer")
End If
 
End Sub
à part que vb indique un problème sur cette procédure

J'ai vraiment besoin d'aide.

Cordialement

Ps ; si vous avez besoin de plus d'informations, prévenez moi,merci