Bonjour,
Je débute sur vb et je voulais lire une colonne de caractére sur un fichier txt.
Lorsque je lis un enregistrement le code marche merveilleusement, mais quand j'utilise une boucle ca marche pas.
Je ne sais pas ou reside le probléme, voila mon code :
Merci d'avance


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Public Class Form1
    Structure manifstruct
        <VBFixedString(4)> Public code As String
        <VBFixedString(21)> Public nom As String
        <VBFixedString(15)> Public prenom As String
 
    End Structure
 
    Private Sub importButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles importButton.Click
        Dim f As Integer
        Dim udtmanif As manifstruct
 
 
 
 
        FileOpen(1, "manif.data", OpenMode.Random, OpenAccess.ReadWrite, OpenShare.Shared, Len(udtmanif))
 
        For num = 1 To i
 
        FileGet(1, udtmanif, num)
        f = f + 1
 
        Next num
 
        FileClose(1)
 
        Me.codeTextBox.Text = udtmanif.code.TrimEnd
        Me.nomTextBox.Text = udtmanif.nom.TrimEnd
        Me.prenomTextBox.Text = udtmanif.prenom.TrimEnd
 
 
 
    End Sub
End Class