I tried using a solution to a very similar question here but it doesnt work for large files like the one I'm using.
The code from that question:
Dim OpenAnswerFile As New OpenFileDialog Dim strFileName() As String '// String Array. Dim tempStr As String = "" '// temp String for result. If OpenAnswerFile.ShowDialog = DialogResult.OK Then '// check if OK was pressed. strFileName = IO.File.ReadAllLines(OpenAnswerFile.FileName) '// add each line as String Array. For Each myLine In strFileName '// loop thru Arrays. tempStr &= myLine & vbNewLine '// add Array and new line. Next MsgBox(tempStr) '// display result. End If
This works perfectly for small files but when I try to use it with a 350,000+ line dictionary the program just hangs... and hangs...
outputRichTxtBox.Text = tempStr
which of course made no difference at all.
I'm trying to speed up access to my dictionary file so I can do multiple searches against it quickly. Currently I access the text file directly which functions fine but the hard drive read speed is slow for just one search (3-5 seconds) so if I want to do potentially hundreds of searches it needs to be a lot faster.
Dictionary file is 1 word per line .txt file
x350,000 more words long
Edited 3 Years Ago by robert.knighton.79