Mi ero dimenticato di dire (ma credo che non abbia importanza) che il 2° file è ad accesso casuale.
Questo è quello che avevo fatto io ma come si può vedere non va bene:
Così non funziona, e non riesco a trovare una soluzione.
______________________________________________________________________
FileOpen(1, File2, OpenMode.Random, , , Len(file))
Do Until EOF(1)
FileGet(1, file)
numord1 = UCase(Trim(file.file01))
prezzo = file.file16
Using leggi As New Microsoft.VisualBasic.FileIO.TextFieldParser(file1)
leggi.TextFieldType = FileIO.FieldType.Delimited
leggi.SetDelimiters(";")
Dim currentrow As String()
While Not leggi.EndOfData
currentrow = leggi.ReadFields()
Dim currentfield As String
For Each currentfield In currentrow
n = n + 1
campo(n) = currentfield
numord2 = UCase(campo(2))
If numord2 = numord1 Then campo(22) = prezzo
If n < 22 Then
My.Computer.FileSystem.WriteAllText(file2, campo(n) & ";", True)
Else
My.Computer.FileSystem.WriteAllText(file2, campo(n), True)
My.Computer.FileSystem.WriteAllText(file2, vbCrLf, False)
n = 0
End If
Next
End While
End Using
Loop
|