Faire des recherches dans la liste "MSFlexGrid1"

Fermé
accent19811 Messages postés 105 Date d'inscription mercredi 4 janvier 2012 Statut Membre Dernière intervention 28 mai 2023 - 25 sept. 2017 à 13:44
yg_be Messages postés 22708 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 20 avril 2024 - 30 sept. 2017 à 11:00
Bonjour,

j'ai une liste contient des données, mais j'ai fait un code de rechercher dans la liste.

je vous passe le rechercher Entrée : ( TEXT1.TEXT et Liste,)

Voir :

TEXT1.TEXT = "P1482"

Liste :
-------------------------------------------------------
N°ARTICLE|Prix TTC
-------------------------------------------------------
P1122------|500.00
P1144------|400.00
P1482------|500.00
P3366------|600.00
P8855------|700.00
P9955------|200.00
P4411------|100.00
P1548------|900.00
------------------------------------------------------
Mon code VB , si le numéro d'article (TEXT1.TEXT) existe dans La Liste s'affiche "OUI"
dans la text2.text sinon s'affiche "NON"

If TEXT1.Text <> "" Then
TEXT2.Text = ""
        For i = 1 To MSFlexGrid1.Rows - 1
                If MSFlexGrid1.TextMatrix(i, 0) = TEXT1.TEXT Then
                TEXT2.TEXT = "OUI"
                ElseIf MSFlexGrid1.TextMatrix(i, 0) <> TEXT1.TEXT Then
                TEXT2.TEXT = "NON"
                End If
        Next I
End If



Mais ce code marche pas !!!!!!!!!!!!!!!!!!!!!!

2 réponses

yg_be Messages postés 22708 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 20 avril 2024 1 474
26 sept. 2017 à 00:09
bonsoir, "marche pas", message, d'erreur résultat inattendu?
petre-être ainsi:
TEXT2.Text = "NON"
        For i = 1 To MSFlexGrid1.Rows - 1
                If MSFlexGrid1.TextMatrix(i, 0) = TEXT1.TEXT Then
                       TEXT2.TEXT = "OUI"
                End If
        Next I
End If
0
accent19811 Messages postés 105 Date d'inscription mercredi 4 janvier 2012 Statut Membre Dernière intervention 28 mai 2023
26 sept. 2017 à 00:54
Metci à votre réponse Mr, yg_be
0
yg_be Messages postés 22708 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 20 avril 2024 1 474
30 sept. 2017 à 11:00
si c'est résolu, peux-tu le marquer comme résolu?
0