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
|
Private Function remplir_ListView2(
Optional sPath As String = "C:LeCheminDeMonFichier.text",
Optional sSeperator As String = "|") As Boolean
Dim aline() As String
Dim objReader As IO.StreamReader
Dim sLine As String
Dim arrText As New ArrayList()
Dim listVIt As ListViewItem
remplir_ListView2 = False
Try
sLine = ""
If Len(sPath) = 0 Then sPath = "C:LeCheminDeMonFichier.text"
sSeperator = "|"
objReader = New IO.StreamReader(sPath)
If IO.File.Exists(sPath) Then
ListView2.View = View.Details
ListView2.GridLines = True
ListView2.FullRowSelect = True
ListView2.Dock = DockStyle.Bottom
ListView2.Columns.Add("Client")
ListView2.Columns.Add("Adresse")
ListView2.Columns.Add("numBL")
ListView2.Columns.Add("totalColis")
ListView2.Columns.Add("indColis")
Do
sLine = objReader.ReadLine()
If Not sLine Is Nothing Then
aline = sLine.Split(sSeperator)
listVIt = New ListViewItem(aline)
ListView2.Items.Add(listVIt)
End If
Loop Until sLine Is Nothing
objReader.Close()
End If
remplir_ListView2 = True
Catch ex As Exception
End Try
End Function |
Partager