Hallo, wie kann ich am besten meine Items immer Oben Einfügen?
Sprich das Letzt Hinzugefügte Item soll immer an erster Stelle stehen?
So lade ich mein ListView;
Sprich das Letzt Hinzugefügte Item soll immer an erster Stelle stehen?
So lade ich mein ListView;
VB.NET-Quellcode
- Dim li As New ListViewItem
- Dim Filename As String
- Dim TFile As System.IO.StreamReader
- Dim sRGB As String()
- Dim S As String
- Dim X, Y As Integer
- Dim S1, S2, S3, S4, S5, S6, S7, S8, S9, S10 As String
- Try
- Filename = "F:\DB2017.lst"
- ListView1.Items.Clear()
- TFile = My.Computer.FileSystem.OpenTextFileReader(Filename)
- Do While (TFile.Peek() > -1)
- X = ListView1.Items.Count
- S = Trim(TFile.ReadLine)
- sRGB = S.Split(",")
- S1 = sRGB(0)
- S2 = sRGB(1)
- S3 = sRGB(2)
- S4 = sRGB(3)
- S5 = sRGB(4)
- S6 = sRGB(5)
- S7 = sRGB(6)
- S8 = sRGB(7)
- S9 = sRGB(8)
- S10 = sRGB(9)
- Dim item As ListViewItem = ListView1.Items.Add(S1)
- item.SubItems.Add(S2)
- item.SubItems.Add(S3)
- item.SubItems.Add(S4)
- item.SubItems.Add(S5)
- item.SubItems.Add(S6)
- item.SubItems.Add(S7)
- item.SubItems.Add(S8)
- item.SubItems.Add(S9)
- item.SubItems.Add(S10)
- item.ImageIndex = 1
- Loop
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- li.Checked = True
- ToolStripStatusLabel2.Text = "Aufträge: " & ListView1.Items.Count.ToString
- TFile.Close()