Recherche performant dans LISTVIEW EN VB.net
Résolu/Fermé
thisisonehood
Messages postés
19
Date d'inscription
lundi 23 avril 2012
Statut
Membre
Dernière intervention
12 septembre 2015
-
23 mai 2012 à 10:10
vbnet101 - 1 nov. 2012 à 12:54
vbnet101 - 1 nov. 2012 à 12:54
A voir également:
- Recherche performant dans LISTVIEW EN VB.net
- Recherche automatique des chaînes ne fonctionne pas - Guide
- Rechercher ou entrer l'adresse mm - recherche google - Guide
- Test performance pc en ligne - Guide
- Recherche photo - Guide
- Recherche adresse - Guide
1 réponse
Exemple :
Private Sub btn_Rechercher_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Rechercher.Click Dim Chaine As String = Me.tbx_Recherche.Text Dim Message As New System.Text.StringBuilder If (Not (String.IsNullOrEmpty(Chaine))) Then Dim ListeLigne1 As ListViewItem = (From Element As ListViewItem In lvw_Sources.Items.Cast(Of ListViewItem)() _ Select Element _ Where Element.SubItems(0).Text = Chaine).FirstOrDefault Dim ListeLigne2 As ListViewItem = (From Element As ListViewItem In lvw_Sources.Items.Cast(Of ListViewItem)() _ Select Element _ Where Element.SubItems(1).Text = Chaine).FirstOrDefault Dim ListeLigne3 As ListViewItem = (From Element As ListViewItem In lvw_Sources.Items.Cast(Of ListViewItem)() _ Select Element _ Where Element.SubItems(2).Text = Chaine).FirstOrDefault If ((ListeLigne1 IsNot Nothing) Or (ListeLigne2 IsNot Nothing) Or (ListeLigne3 IsNot Nothing)) Then If (ListeLigne1 IsNot Nothing) Then Message.AppendLine("Trouvé 1ère colonne: ") Message.AppendLine(ListeLigne1.SubItems(0).Text) Else If (ListeLigne2 IsNot Nothing) Then Message.AppendLine("Trouvé 2ième colonne: ") Message.AppendLine(ListeLigne2.SubItems(1).Text) Else If (ListeLigne3 IsNot Nothing) Then Message.AppendLine("Trouvé 3ième colonne: ") Message.AppendLine(ListeLigne3.SubItems(2).Text) End If End If End If Else Message.AppendLine("Non trouvé : ") Message.AppendLine(Chaine) End If MessageBox.Show(Message.ToString, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub