Bonjour, je reviens vers vous car j'aimerais savoir comment je peux supprimé les ligne double de la ListBox avant de passer à la page suivante.

Voici le code.

Code vb.net : 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
 
Imports System.Text.RegularExpressions
Imports System.Net
Imports System.Threading
Imports System.IO
Imports System.Text
 
Public Class Form1
 
 
    Dim url As String
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        For i As Integer = 1 To NumericUpDown1.Value
 
            url = "http://exemple.com/page=" & i
 
            Dim website As String = url
            Dim source As String
            Dim wcli As WebClient
            Dim r As New Regex("<title>(.*)</title>")
 
            wcli = New WebClient()
            wcli.Encoding = System.Text.Encoding.UTF8
 
            source = wcli.DownloadString(website)
            For Each m As Match In r.Matches(source)
                Dim res As String
                res = m.Value
                res = res.Replace(("<title>"), "")
                res = res.Replace(("</title>"), "")
                Invoke(New MethodInvoker(Sub() Namelist.Items.Add(res)))
 
            Next
        Next
 
 
 
        MessageBox.Show(Namelist.Items.Count)
 
 
 
    End Sub
 
 
 
 
 
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
 
 
        Dim savefile As New SaveFileDialog
        With savefile
            .Filter = "Text file|*.txt"
            .ShowDialog()
        End With
        If Not savefile.FileName = Nothing Then
            Dim [stream] As Stream = savefile.OpenFile
            For i = 0 To Namelist.Items.Count - 1
                Dim sw As New StreamWriter([stream])
                sw.WriteLine(Namelist.Items.Item(i).ToString)
                sw.Flush()
            Next
        End If
 
 
 
 
    End Sub
 
    Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
        NumericUpDown1.Maximum = 2500
        NumericUpDown1.Minimum = -100
    End Sub
 
    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
 
    End Sub
 
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Namelist.Items.Clear()
    End Sub
 
    Private Sub Namelist_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Namelist.SelectedIndexChanged
 
    End Sub
 
 
 
End Class

Merci de votre aide.