I like the idea of having all the elements accessible like you would access them say in a listview ,,but man this is way too slow..
what i was using before i tried this way was..
which of course was done in a blink of an eye..the problem however was i couldn't figure out how to change things in the array...my strings were like item1|Item2|items3| etc.
which was why i was interested in this code,, does anyone know how to make the code below go as fast or nearly as fast as my previous coded line?
or can offer a better solution to what i'm aiming for?
what i was using before i tried this way was..
Code:
ItemList.AddRange(IO.File.ReadAllLines(path))
which was why i was interested in this code,, does anyone know how to make the code below go as fast or nearly as fast as my previous coded line?
or can offer a better solution to what i'm aiming for?
Code:
Imports System.Collections
Imports System.IO
Structure Manual
Dim udtManual As String
Dim StrModel As String
Dim StrDocument As String
Dim StrDocType As String
Dim StrDescription As String
Dim StrByteSize As String
Dim StrFileSize As String
Dim StrStatus As String
Dim StrCRC As String
Dim StrManualType As String
Dim StrFileName As String
End Structure
Public Class Test
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim alManuals As New ArrayList
Dim udtManual As New Manual
Dim strFileName As String = "C:\Documents and Settings\Upyours\Desktop\Backup1\Test\bin\Debug\File.txt"
Dim objFilename As FileStream = New FileStream(strFileName, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim objFileRead As StreamReader = New StreamReader(objFilename)
Do While (objFileRead.Peek() > -1)
Application.DoEvents()
Dim NLine = objFileRead.ReadLine().Split("|")
With udtManual
.StrModel = NLine(0)
.StrDocument = NLine(1)
.StrDocType = NLine(2)
.StrDescription = NLine(3)
.StrByteSize = NLine(4)
.StrFileSize = NLine(5)
.StrStatus = NLine(6)
.StrCRC = NLine(7)
.StrFileName = NLine(8)
.StrManualType = NLine(9)
End With
If Not alManuals.Contains(udtManual.StrFileName) Then
alManuals.Insert(0, udtManual)
End If
Loop
objFileRead.Close()
'Display the array list values.
MsgBox("The array list contains " & alManuals.Count & " elements.")
For Each udtManual In alManuals
MsgBox("NAME: " & udtManual.StrModel & " " & udtManual.StrDocument & " " & udtManual.StrDescription & " " & udtManual.StrFileName)
Next udtManual
End Sub
End Class