Fonction Current Row de fichier .csv
Bonjour,
Alors j'ai un petit code en Vb.net dont je rentre un nom dans le champ NomTextBox.txt et ca retourne le prenon Respectivement dans le PrenonTextBox.txt , les informations sont saisis a partire d'un fichier .csv
mais admettons que il ya plusieurs noms mais avec differente prenom comment faire pour afficher tout les prenon qui correspond au nom ?
dans une liste box ou vous me suggerer quoi?
a l'aide!
Merci en avance
Code:
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
|
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser _
("C:\Documents and Settings\farah\Mes documents\Downloads\Artistes.csv")
'TextFieldType:Indique si le fichier à analyser est délimité ou à largeur fixe.
MyReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited
'set the delimiter to any value
MyReader.Delimiters = New String() {";"}
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
'ouput the second value of each line to show that the file has been parsed.
If (codeA.Text + codeB.Text + codeC.Text = (currentRow(0))) Then
NomBox.Text = currentRow(1)
PrenonBox.Text = currentRow(2)
LBox.Text = currentRow(3)
End If
If (NomBox.Text = currentRow(1)) Then
' codeA.Text(+codeB.Text + codeC.Text = currentRow(0))
PrenonBox.Text = currentRow(2)
LBox.Text = currentRow(3)
End If |