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
|
Public Sub ChargeTabPaysLang()
Dim Words() As String
Dim Word As String = String.Empty
Dim TabPaysLang(137, 3) as string
Dim FileString As String = String.Empty
Dim f As String = My.Application.Info.DirectoryPath & "\_VAR_PAYS_PL.txt"
If File.Exists(f) Then
System.IO.File.WriteAllText(f, My.Resources._VAR_PAYS_PL)
Else
MessageBox.Show("Fichier des Pays -> Langues impossible à trouver..." & vbCrLf & "Désolé...")
Exit Sub
End If
'chaque ligne du fichier se présente comme suit : FRANCAIS_FRANCE*France.jpg*18
Dim fr As New System.IO.StreamReader(CStr(f))
Dim i%
For i = 1 To 137
FileString = fr.ReadLine
If FileString = "" Then Exit For
Words = Split(FileString, "*")
X = 1
For Each Word As String In Words
'Il bugue à cette ligne (au mot Word semble-t-il):
If X = 1 Then TabPaysLang(i, 1) = Word
If X = 2 Then TabPaysLang(i, 2) = Word
If X = 3 Then TabPaysLang(i, 3) = Word
X = X + 1
Next Word
Next
End Sub
'J'ai essayé en indexant les Word :
For Each Word As String In Words
'Il bugue à cette ligne (au mot Word semble-t-il):
If X = 1 Then TabPaysLang(i, 1) = Word(0)
If X = 2 Then TabPaysLang(i, 2) = Word(1)
If X = 3 Then TabPaysLang(i, 3) = Word(2)
X = X + 1
Next Word
'mais ça ne change pas l'erreur. En fait, je ne sais pas trop, compte
'tenu que c'est dans une boucle For Each, si je dois indexer les Word ou pas. |
Partager