le tableau se remplis avec des formulaires à remplir par l'utilisateur.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim MAIL0(40, 5) As String
Dim MAIL(40, 5) As String
MAIL0(0, 0) = Umail1a.Text
MAIL = MAIL0
Umail1.Text = MAIL(0, 0)
Dim file As System.IO.StreamWriter
Dim mywriteline As String
Dim i As Integer
'Ouverture du fichier en écriture, en effaçant les lignes existantes.
file = My.Computer.FileSystem.OpenTextFileWriter(My.Computer.FileSystem.CurrentDirectory & "\tarif.txt", False)
'écriture ligne par ligne
ligne = ""
Do Until i > 38
ligne = MAIL(i, 0) & "|" & MAIL(i, 1) & "|" & MAIL(i, 2) & "|" & MAIL(i, 3) & "|" & MAIL(i, 4)
file.WriteLine(ligne)
i = i + 1
Loop
file.Close()
For i = 0 to n For j = 0 to m 'code à faire next j next i
Dim toto(2, 2) As String
Private Sub Command1_Click()
' juste pour se faire un petit tableau de test
For i = 0 To 2
For j = 0 To 2
toto(i, j) = "a" & i & j
Next
Next
'on l'écrit
Open "d:\essai.txt" For Output As #1
For i = LBound(toto) To UBound(toto)
Write #1, toto(i, 0), toto(i, 1), toto(i, 2)
Next
Close #1
End Sub
Private Sub Command2_Click()
'preuve =====
Erase toto ' pas nécessaire. Juste pour prouver
Open "d:\essai.txt" For Input As #1
For i = LBound(toto) To UBound(toto)
Input #1, toto(i, 0), toto(i, 1), toto(i, 2)
Next
Close #1
'preuve
For i = 0 To 2
For j = 0 To 2
MsgBox toto(i, j)
Next
Next
End Sub
Dim filer As System.IO.StreamReader
Dim myreadline As String
Dim j As Integer
Dim col(4) As String
Dim k As Integer
filer = My.Computer.FileSystem.OpenTextFileReader(My.Computer.FileSystem.CurrentDirectory & "\tarif.txt")
Do Until k > 38
myreadline = filer.ReadLine
col = Split(myreadline, "|")
Do Until j > 4
MAIL(k, j) = col(j)
j = j + 1
Loop
k = k + 1
Loop
filer = My.Computer.FileSystem.OpenTextFileReader(My.Computer.FileSystem.CurrentDirectory & "\tarif.txt")
Théo 15 juin 2015 à 14:34
Je suis en VB6 :)
Dim toto(4, 3) As String
Private Sub Command1_Click()
' juste pour se faire un petit tableau de test
For i = 0 To UBound(toto, 1)
For j = 0 To UBound(toto, 2)
toto(i, j) = "a" & i & j
Next
Next
'on l'écrit
Open "d:\essai.txt" For Output As #1
For i = LBound(toto, 1) To UBound(toto, 1)
For j = LBound(toto, 2) To UBound(toto, 2)
Print #1, toto(i, j) '====>> ici : le Print et plus le Write
Next
Next
Close #1
End Sub
Private Sub Command2_Click()
'preuve =====
Erase toto ' pas nécessaire. Juste pour prouver
Open "d:\essai.txt" For Input As #1
' et maintenant : de l'arithmétique +++>>
For i = 0 To UBound(toto, 1) * UBound(toto, 2) Step UBound(toto, 2)
For j = 0 To UBound(toto, 2)
Input #1, toto(i / UBound(toto, 2), j) ' ah ! cette belle division (MDR)
Next
Next
Close #1
'preuve
For i = 0 To UBound(toto, 1)
For j = 0 To UBound(toto, 2)
MsgBox toto(i, j)
Next
Next
End Sub