IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

coller un texte dans un textbox et le parcourir ligne par ligne pour tester s'il contient des erreurs


Sujet :

VB.NET

  1. #1
    Membre du Club
    Femme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Juin 2014
    Messages
    51
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2014
    Messages : 51
    Points : 40
    Points
    40
    Par défaut coller un texte dans un textbox et le parcourir ligne par ligne pour tester s'il contient des erreurs
    bonjour , je suis en train de developper une interface en vb.net qui donne à l'utilisateur la main de copier coller un texte dans un textbox et puis cliquer sur un bouton pour tester si le texte collé contient des erreurs ou non .et faire les traitement necessaires .J'ai fait un traitement erroné dans ce code , peut etre dans Next j'ai pas su quoi ecrire .. l'essentiel si je clique maintenant sur le bouton test l'interface se ferme directement .c'est tres urgent merci
    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
    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            indic0 = False
            indic1 = False
            indic2 = False
            indic3 = False
            indic4 = False
            indic5 = False
            indic6 = False
            indic7 = False
            LabelDCT0.Visible = False
            LabelDCT1.Visible = False
            LabelDCT2.Visible = False
            LabelDCT3.Visible = False
            LabelDCT4.Visible = False
            LabelDCT5.Visible = False
            LabelDCT6.Visible = False
            LabelDCT7.Visible = False
            LabelDCT71.Visible = False
            LabelDCT01.Visible = False
            LabelDCT21.Visible = False
            LabelDCT31.Visible = False
            LabelDCT41.Visible = False
            LabelDCT51.Visible = False
            LabelDCT61.Visible = False
            LabelDCT11.Visible = False
     
     
            For Each strLine As String In TextBox1.Text.Split(vbNewLine)
                If strLine.Contains(SOC_Erreur0) Then
                    indic0 = False
                End If
                If strLine.Contains(SOC_Erreur00) Then
                    indic0 = True
                End If
                If strLine.Contains(SOC_Erreur01) Then
                    indic1 = True
                End If
     
                If strLine.Contains(SOC_Erreur02) Then
                    indic2 = 0
                End If
                If strLine.Contains(SOC_Erreur03) Then
                    indic3 = True
                End If
                If strLine.Contains(SOC_Erreur04) Then
                    indic4 = True
                End If
                If strLine.Contains(SOC_Erreur05) Then
                    indic5 = True
                End If
                If strLine.Contains(SOC_Erreur06) Then
                    indic6 = True
                End If
                If strLine.Contains(SOC_Erreur07) Then
                    indic7 = True
                End If
                'ERROR TYPE 3:
                If strLine.Contains(SOC_Erreur10) Then
                    indic0 = True
                End If
                If strLine.Contains(SOC_Erreur11) Then
                    indic1 = True
                End If
     
                If strLine.Contains(SOC_Erreur12) Then
                    indic2 = True
                End If
                If strLine.Contains(SOC_Erreur13) Then
                    indic3 = True
                End If
                If strLine.Contains(SOC_Erreur14) Then
                    indic4 = True
                End If
                If strLine.Contains(SOC_Erreur15) Then
                    indic5 = True
                End If
     
                If strLine.Contains(SOC_Erreur16) Then
                    indic6 = True
                End If
     
                If strLine.Contains(SOC_Erreur17) Then
                    indic7 = True
                End If
     
                'ERROR TYPE 4:
                If strLine.Contains(SOC_Erreur20) Then
                    indic0 = True
                End If
                If strLine.Contains(SOC_Erreur21) Then
                    indic1 = True
     
                End If
     
                If strLine.Contains(SOC_Erreur22) Then
                    indic2 = False
                End If
                If strLine.Contains(SOC_Erreur23) Then
                    indic3 = True
     
                End If
                If strLine.Contains(SOC_Erreur24) Then
                    indic4 = True
                End If
                If strLine.Contains(SOC_Erreur25) Then
                    indic5 = True
                End If
                If strLine.Contains(SOC_Erreur26) Then
                    indic6 = True
                End If
                If strLine.Contains(SOC_Erreur27) Then
                    indic7 = True
                End If
                'ERROR TYPE5
                If strLine.Contains(SOC_Erreur30) Then
                    indic0 = True
                End If
                If strLine.Contains(SOC_Erreur31) Then
                    indic1 = True
                End If
                If strLine.Contains(SOC_Erreur32) Then
                    indic2 = True
                End If
                If strLine.Contains(SOC_Erreur33) Then
                    indic3 = True
                End If
                If strLine.Contains(SOC_Erreur34) Then
                    indic4 = True
                End If
                If strLine.Contains(SOC_Erreur35) Then
                    indic5 = True
                End If
                If strLine.Contains(SOC_Erreur36) Then
                    indic6 = True
                End If
                If strLine.Contains(SOC_Erreur37) Then
                    indic7 = True
                End If
            Next
                End
     
        End Sub

  2. #2
    Membre actif
    Profil pro
    Inscrit en
    Juin 2010
    Messages
    210
    Détails du profil
    Informations personnelles :
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Juin 2010
    Messages : 210
    Points : 243
    Points
    243
    Par défaut
    Bonjour,

    Après le "next" vous avez un "End" qui se balade me semble t'il.

    Que voulez vous dire par
    peut etre dans Next j'ai pas su quoi ecrire ?
    A+

  3. #3
    Membre régulier
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Août 2014
    Messages
    63
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux

    Informations forums :
    Inscription : Août 2014
    Messages : 63
    Points : 123
    Points
    123
    Par défaut
    Bonjour,

    Le terme Next signifie la fin de la boucle "for each" un peut comme un End while donc tu n'a rien à écrire sauf si tu dois faire des instructions après la vérification
    Il y a bien un End qui est en trop

    Ensuite si cela ne corrige pas et que l'appli se ferme alors VS dois te dire pour quel raison ça plante (exception)

    En espérant avoir aidé
    Bonne journée

  4. #4
    Membre chevronné
    Avatar de Sehnsucht
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Octobre 2008
    Messages
    847
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Lot et Garonne (Aquitaine)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Octobre 2008
    Messages : 847
    Points : 2 209
    Points
    2 209
    Par défaut
    C'est bien le End qui est en trop, et c'est tout à fait normal que l'appli se ferme et qu'il n'y ait aucun message d'erreur ou autre.
    Pour plus d'infos je renvoie à la documentation de End
    Nous sommes tous plus ou moins geek : ce qui est inutile nous est parfaitement indispensable ( © Celira )
    À quelle heure dormez-vous ?
    Censément, quelqu'un de sensé est censé s'exprimer sensément.

  5. #5
    Membre du Club
    Femme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Juin 2014
    Messages
    51
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2014
    Messages : 51
    Points : 40
    Points
    40
    Par défaut
    Bonjour ,oui c'est bien ce End qui m'a fait le probléme .j'ai pas fait attention ! merci pour vous

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [VB.NET] Sélection de texte dans un textbox
    Par olbi dans le forum Windows Forms
    Réponses: 5
    Dernier message: 25/08/2014, 10h26
  2. [VB.NET] Couleur du texte dans un TextBox désactivé
    Par Cricket dans le forum Windows Forms
    Réponses: 9
    Dernier message: 08/10/2013, 22h16
  3. Coller du texte dans n'importe quelle application
    Par LapinEnSucre dans le forum Windows Forms
    Réponses: 1
    Dernier message: 18/03/2007, 10h31
  4. Colorer texte dans une textbox
    Par metatron dans le forum Balisage (X)HTML et validation W3C
    Réponses: 1
    Dernier message: 27/09/2006, 18h31
  5. Copier/coller un texte dans un richedit
    Par bipeurs dans le forum Windows
    Réponses: 1
    Dernier message: 03/08/2006, 02h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo