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
|
Dim strApp(100)
Dim strEmer(100, 20)
Dim EmergId(100, 20)
Dim strUsr(100, 20)
Dim userid(100, 20)
Dim strdom(100)
Public Sub Form_Load()
sFile = "c:\toto.txt"
Fnum = FreeFile()
Open sFile For Input As #Fnum
nIndex = 0
nrec = 0
Do While Not EOF(Fnum)
Input #1, tData
taryrecord = Split(tData, ";")
' Nom de l'application
strApp(nrec) = taryrecord(0)
List1.AddItem (strApp(nrec))
'nom domaine
strdom(nrec) = taryrecord(3)
' Nombre d'Utilisateurs
nCountusr = 0
rCode = fDelimiterCount(taryrecord(1), "/", nCountusr)
' Séparation des users
taryusr = Split(taryrecord(1), "/")
For i = 0 To nCountusr
strUsr(nrec, i) = taryusr(i)
Next
' Nombre des comptes Emergency
nCount = 0
rCode = fDelimiterCount(taryrecord(2), "/", nCount)
' Séparation des Comptes
tAryEmerg = Split(taryrecord(2), "/")
For i = 0 To nCount
strEmer(nrec, i) = tAryEmerg(i)
Emerg = Split(strEmer(nrec, i), "@")
EmergId(nrec, i) = Emerg(0)
userid(nrec, i) = Emerg(1)
Next
nrec = nrec + 1
Loop
Close Fnum
End Sub
Private Function fDelimiterCount(ByRef strData, ByRef chrSeparator, ByRef nCountusr) As Integer
nCount = 0
nLenght = Len(strData)
For i = 1 To nLenght
If Mid(strData, i, 1) = chrSeparator Then
nCountusr = nCountusr + 1
End If
Next
End Function
Private Sub List1_Click()
nselecteditem = List1.ListIndex
List4.Clear
List2.Clear
List3.Clear
i = 0
n = 0
While EmergId(nselecteditem, i) <> ""
List2.AddItem EmergId(nrec, i)
i = i + 1
Wend
List2.Selected(0) = True
List3.Clear
List3.AddItem strdom(nselecteditem)
List3.Selected(0) = True
While strUsr(nselecteditem, n) <> ""
List4.AddItem strUsr(nselecteditem, n)
n = n + 1
Wend
List4.Selected(0) = True
End Sub |
Partager