counting occurenece of each word in a large text file
hi all , I'm using regex object to count occurrence of each word in a text file with (44644 words ). i put all words in Matches , then put them in a list box , and i find the number of occurrences for each word using another list box with listview . the program is work well with a small text file , but the problem when i use the text file with (44644 words). the words can be list in the box but the occurrence of each word doesn't show in listview . please can any help how solve this problem .
Re: counting occurenece of each word in a large text file
Post your code please, it will help us.
JeffB
Re: counting occurenece of each word in a large text file
ok , sure ... but please help with my problem , the following program work with small text file but when i use it with large text file the result don't show on the listview
assume the lisbox1 contain (44644)items
Code:
Public Function countoccurences()
Dim i, j
Dim lst As ListItem
For i = 0 To List1.ListCount - 1
For j = 0 To List2.ListCount - 1
If List1.List(i) = List2.List(j) Then
List2.ItemData(j) = List2.ItemData(j) + 1
Exit For
End If
Next j
If j = List2.ListCount Then
List2.AddItem List1.List(i)
List2.ItemData(List2.NewIndex) = 1
End If
Next i
For j = 0 To List2.ListCount - 1 Step 1
Set lst = ListView1.ListItems.Add(, , List2.List(j))
lst.ListSubItems.Add , , List2.ItemData(j)
Next j
End Function
Private Sub Form_Load()
ListView1.ColumnHeaders.Add , , "Word"
ListView1.ColumnHeaders.Add , , "Frequency"
End Sub
Re: counting occurenece of each word in a large text file
Listbox can only hold 32K items! Nobody reads more than 10 or so items, so, I'd re-think that part
Re: counting occurenece of each word in a large text file
then how can i deal with this matter , i spent 1 month just to find a solution but i haven't find ... please help