SOS VB.NET tableau multi dimensionnel
Résolu/Fermé
suuuif
Messages postés
25
Date d'inscription
mardi 26 février 2008
Statut
Membre
Dernière intervention
20 avril 2012
-
17 avril 2012 à 15:54
suuuif Messages postés 25 Date d'inscription mardi 26 février 2008 Statut Membre Dernière intervention 20 avril 2012 - 18 avril 2012 à 16:16
suuuif Messages postés 25 Date d'inscription mardi 26 février 2008 Statut Membre Dernière intervention 20 avril 2012 - 18 avril 2012 à 16:16
A voir également:
- SOS VB.NET tableau multi dimensionnel
- Tableau croisé dynamique - Guide
- Tableau ascii - Guide
- Whatsapp multi appareil - Guide
- Afficher un tableau en c - Forum C
- Multi exp heartgold - Forum Jeux vidéo
1 réponse
suuuif
Messages postés
25
Date d'inscription
mardi 26 février 2008
Statut
Membre
Dernière intervention
20 avril 2012
1
18 avril 2012 à 16:16
18 avril 2012 à 16:16
Juste dire que j'ai trouvé la solution il suffisait juste de changer ma méthode
Et voici la soluce:
Et voici la soluce:
Private Sub TraiterLeLogToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TraiterLeLogToolStripMenuItem.Click
Dim nLignes() As String = txtLog.Lines 'Decoupe le texte principal par ligne
Dim i, j As Integer
Dim tampon(0) As String
Dim Taille As Integer
Dim tabTri() As String = txtLog.Lines 'Affectation du contenu du 1er Tableau pour preserver son contenu
'Determine la valeur de la ligne la plus longue
Taille = 0
For i = 0 To UBound(tabTri)
If Taille < tabTri(i).Length Then
Taille = tabTri(i).Length
End If
Next i
MsgBox("la taille maxi est :" & Taille)
'Decoupe chaque ligne par mots
Dim tabSemifini(UBound(nLignes), Taille) As String
Dim LigneTempo As String = "" 'Tableau temporaire reçoit la ligne decoupé en chaînes
For i = 0 To UBound(nLignes)
LigneTempo = nLignes(i)
Dim Tabtempo() As String = LigneTempo.Split(" ")
For j = 0 To UBound(Tabtempo)
tabSemifini(i, j) = Tabtempo(j)
Next j
Next i
'Test de verification (Test passé avec succès)
For i = 0 To UBound(tabSemifini, 1)
For j = 0 To UBound(tabSemifini, 2)
If tabSemifini(i, j + 1) = "" Then Exit For
Next j
Next i
Dim strDate(UBound(nLignes)) As Date
Dim strHeure(UBound(nLignes)) As Date
Dim strEtat(UBound(nLignes)) As String
Dim strExpediteur(UBound(nLignes)) As String
Dim strDestinataire(UBound(nLignes)) As String
Dim strSMSC(UBound(nLignes)) As String
Dim strSVC(UBound(nLignes)) As String
Dim strACT(UBound(nLignes)) As String
Dim strFID(UBound(nLignes)) As String
Dim strBINF(UBound(nLignes)) As String
Dim strFrom(UBound(nLignes)) As String
Dim strFlags(UBound(nLignes)) As String
Dim strUDH(UBound(nLignes)) As String
Dim strMsg(UBound(nLignes)) As String
Dim strTaille(UBound(nLignes)) As String
For i = 0 To UBound(tabSemifini, 1)
For j = 0 To UBound(tabSemifini, 2)
Dim y As Integer
If tabSemifini(i, j) <> "" Then
Select Case j
Case 0
strDate(i) = tabSemifini(i, j)
Case 1
strHeure(i) = tabSemifini(i, j)
Case 2
If tabSemifini(i, j) = "SENT" Then
strEtat(i) = tabSemifini(i, j)
Else
strEtat(i) = tabSemifini(i, j + 1)
End If
Case 4
strSMSC(i) = tabSemifini(i, j)
Case 5
strSVC(i) = tabSemifini(i, j)
Case 6
strACT(i) = tabSemifini(i, j)
Case 7
strBINF(i) = tabSemifini(i, j)
Case 8
strFID(i) = tabSemifini(i, j)
Case 9
strExpediteur(i) = tabSemifini(i, j)
Case 10
strDestinataire(i) = tabSemifini(i, j)
Case 11
strFlags(i) = tabSemifini(i, j)
Case 12
strTaille(i) = tabSemifini(i, j)
Case 13
For y = j To UBound(tabSemifini, 2)
If tabSemifini(i, y) <> "[UDH:0]" And tabSemifini(i, y) <> "" Then
strMsg(i) = strMsg(i) & " " & tabSemifini(i, y)
ElseIf tabSemifini(i, j) = "[UDH:0]" Then
strUDH(i) = tabSemifini(i, y)
Else : Exit For
End If
Next y
End Select
Else : Exit For
End If
Next j
Next i
'Test de vérité
Dim tempo As String = ""
For i = 0 To 2
tempo = strDate(i) & vbTab & strHeure(i) & vbTab & strEtat(i) & vbTab & strSMSC(i) & vbTab & _
strSVC(i) & vbTab & strACT(i) & vbTab & strBINF(i) & vbTab & strFID(i) & vbCrLf _
& strExpediteur(i) & vbTab & strDestinataire(i) & vbTab & strFlags(i) & vbCrLf _
& strTaille(i) & vbTab & strUDH(i) & vbCrLf & strMsg(i)
MsgBox(tempo, MsgBoxStyle.Information)
Next i
End Sub