TabPaysLang(idLigne, X) = word
Dim lignes As String() = (My.Resources._VAR_PAYS_PL).Split(vbCrLf) Dim idLigne As Integer = 0 Dim TabPaysLang(0 To 136, 0 To 2) Dim Mot As String = String.Empty Dim Mot1 As String = String.Empty Dim Mot2 As String = String.Empty For Each ligne As String In lignes Mot = "" Mot1 = "" Mot2 = "" For i = 1 To ligne.Length Ch = Mid(ligne, i, 1) If Ch = "*" Then If Mot1 = "" Then TabPaysLang(idLigne, 0) = Mot.Trim Mot1 = Mot Mot = "" ElseIf Mot2 = "" Then TabPaysLang(idLigne, 1) = Mot.Trim Mot = "" End If Else Mot = Mot & Ch End If Next TabPaysLang(idLigne, 2) = Mot.Trim 'pour contrôle MessageBox.Show(TabPaysLang(idLigne, 0) & " " & TabPaysLang(idLigne, 1) & " " & TabPaysLang(idLigne, 2)) idLigne += 1 Next
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionImports ASE.Mod_Langues Module Mod_Param #Region "Paramêtres généraux" ' GENERAL 'Variable string Public CheminDepart As String = CurDir() Public CheminConfig As String = CheminDepart & "\data\config" Public CheminDesBases As String = String.Empty Public CheminDesCot As String = String.Empty Public CheminRessources As String = My.Application.Info.DirectoryPath Public TextDesCot As String = String.Empty Public SEPARATOR_SEMICOLON As String = ";" 'Variables integer ou autres nombres Public NouvText As Integer = 0 Public tempoTimer1 As Integer = 100 'Tableaux string Public TabMois(12) As String Public TabDesCotsTries(950, 2) As String Public TabCot(950, 2) As String Public TabRepart(10, 100) As String Public Tab_RTL() As String Public TabLangPays(0 to 136,0 to 2) As String Public TabPaysLang(0 to 136,0 to 2) As String Public TAB_LES_PAYS(0 to 136) As String Public TAB_LANGUES(0 to 136) As String 'couleur des fenêtres Public FondFenetreMain As String = "DimGray" Public FondFenetreOptions As String = "DimGray" Public FondFenetrePalette As String = "DimGray" Public FondFenetreGraph As String = "DimGray" Public FondFenetreEtat As String = "DimGray" Public FondFenetreBilan As String = "DimGray" Public FondFenetreDefDates As String = "DimGray" Public FondFenetreSimul As String = "DimGray" 'couleur des courbes Public CoulCourbe1 As System.Drawing.Color = System.Drawing.Color.Blue Public CoulCourbe2 As System.Drawing.Color = System.Drawing.Color.Aqua Public CoulCourbe3 As System.Drawing.Color = System.Drawing.Color.Green Public CoulCourbe4 As System.Drawing.Color = System.Drawing.Color.Yellow Public CoulCourbe5 As System.Drawing.Color = System.Drawing.Color.Red Public CoulCourbe6 As System.Drawing.Color = System.Drawing.Color.Black #End Region End Module
Public Sub Langue_frFR() Dim ci As New CultureInfo("fr-FR") lg_CodePays = "fr-FR" lg_Pays = "Français - France" lg_Identif = "0x040C" Thread.CurrentThread.CurrentUICulture = ci 'Général 'Mois JANVIER = "Janvier" FEVRIER = "Février" MARS = "Mars" AVRIL = "Avril" MAI = "Mai" ................ end sub
Public Sub ChargeTabPaysLang() Dim lignes As String() = (My.Resources._VAR_PAYS_PL).Split(vbCrLf) Dim Mot As String = String.Empty Dim Mot1 As String = String.Empty Dim Mot2 As String = String.Empty Dim Ch As String = String.Empty Dim i As Integer = 0 Dim X As Integer = 0 For Each ligne As String In lignes Mot = "" Mot1 = "" Mot2 = "" ligne = ligne.Trim For i = 1 To ligne.Length Ch = Mid(ligne, i, 1) If Ch = "*" Then If Mot1 = "" Then TabPaysLang(X, 0) = Mot Mot1 = Mot Mot = "" ElseIf Mot2 = "" Then TabPaysLang(X, 1) = Mot Mot2 = Mot Mot = "" Else TabPaysLang(X, 2) = Mot Mot = "" End If Else Mot = Mot & Ch End If Next TabPaysLang(X, 3) = Mot X += 1 Next End Sub
AFRIQUE_DU_SUD_AFRIKAANS*Afrique_du_Sud.jpg*0*"afZA" AFRIQUE_DU_SUD_ANGLAIS*Afrique_du_Sud.jpg*0*"enZA" ALBANIE_ALBANAIS*Albanie.jpg*1*"sqAL" ALGERIE_ARABE*Algerie.jpg*2*"arDZ" ALLEMAGNE_ALLEMAND*Allemagne.jpg*3*"deDE" ARABIE_SAOUDITE_ARABE*Arabie_Saoudite.jpg*4*"arSA" ARGENTINE_ESPAGNOL*Argentine.jpg*5*"esAR" ARMENIE_ARMENIEN*Armenie.jpg*6*"hyAM" AUSTRALIE_ANGLAIS*Australie.jpg*7*"enAU" AUTRICHE_ALLEMAND*Autriche.jpg*8*"deAT" AZERBAIDJAN_AZERI_CYRILLIQUE*Azerbaidjan.jpg*9*"azAZCyrl" AZERBAIDJAN_AZERI_LATIN*Azerbaidjan.jpg*9*"azAZLatn" BAHREIN_ARABE*Bahrein.jpg*10*"arBH" BELGIQUE_FRANÇAIS*Belgique.jpg*11*"frBE" BELGIQUE_NEERLANDAIS*Belgique.jpg*11*"nlBE"
For Each ligne As String In lignes Mot = "" Mot1 = "" Mot2 = "" ligne = ligne.Trim For i = 1 To ligne.Length Ch = Mid(ligne, i, 1) If Ch = "*" Then If Mot1 = "" Then TabPaysLang(X, 0) = Mot Mot1 = Mot Mot = "" ElseIf Mot2 = "" Then TabPaysLang(X, 1) = Mot Mot2 = Mot Mot = "" Else TabPaysLang(X, 2) = Mot Mot = "" End If Else Mot = Mot & Ch End If Next TabPaysLang(X, 3) = Mot X += 1 Next
Public Class Form1 'Je déclare une structure publique pour recevoir les éléments de ton fichier 'Les variables dans cette structure sont clairement identifiées : nom, image, etc... Public Structure PaysLang Dim nomPays As String Dim imgDrapeau As String Dim variable3 As String Dim variable4 As String End Structure 'Je déclare ensuite une liste qui recevra chacun de tes pays (le premier sera le pays 0) Public listePays As New List(Of PaysLang) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'C'est parti ! ChargeLesLangues() 'Vérification : je prends le 5ème pays par exemple et j'affiche ses valeurs dans un messageBox MessageBox.Show(listePays(4).nomPays & vbCrLf & listePays(4).imgDrapeau & vbCrLf & listePays(4).variable3 & vbCrLf & listePays(4).variable4) End Sub Public Sub ChargeLesLangues() Dim lignes As String() = (My.Resources._VAR_PAYS_PL).Split(vbCrLf) For Each ligne As String In lignes 'Pour chaque ligne, je sépare les mots Dim words As String() = ligne.Split("*") 'On déclare un nouveau pays en tant que structure PaysLang Dim nouveauPays As New PaysLang 'On charge chacun des éléments de la ligne (petite vérification en début de ligne pour contrôler que l'élément existe vraiment) With nouveauPays If words.Length > 0 Then .nomPays = words(0) If words.Length > 1 Then .imgDrapeau = words(1) If words.Length > 2 Then .variable3 = words(2) If words.Length > 3 Then .variable4 = words(3) End With 'On ajoute ce nouveau pays à la liste listePays.Add(nouveauPays) Next 'Fini ! End Sub End Class