Hi All,

Situation:
I'm writing a function to load items into a list or combobox from a textfile in a vb 6.0 class.
But i want to be able to show the loading progress (in a event) in case of a large amount of items.

Problem:
How to calculate the progress percentage without reading the file in advance.
I can get the LOF(#1) (size in bytes) but this won't tell me how many items there are or how large each item is because it includes some overhead for each string (vbCr or vbLf or vbCrLf)
and some overhead for the file itself.
does anyone knows a neat trick to solve this??

The Snippet of Code it's about
Code:
RaiseEvent Progress(0, CtrlName, "LoadItemsFromTextFile")
        Percent = Total \ 100
        If Percent < 0.5 Then Percent = 0.5                     'At small files evaide division by zero.
        Do Until EOF(1)
            Line Input #Fhdl, Item
            Box.AddItem Item
            Processed = Processed + Len(Item) * 1.2          ' 1 char = 2 bytes ,vb werkt intern met unicode)
            If (Processed \ Percent) > 100 Then                 ' PROBLEM ZONE: Restart progress if it exeeds 100 percent. 
               Processed = 0
            End If
            RaiseEvent Progress(Processed / Percent, Box.Name, "LoadItemsFromTextFile")
            
        Loop
Note: all variables events etc... are declared

Thanks in advance.