I don't know exactly what you're doing in your program but it would appear from 
the code you
posted that you could simplify the whole thing into:

dim i as integer
i=objsource.indexof( searchstring )
while i<>-1
objdest.append objsource(i)
i=objsource.indexof( searchstring , i+1)
wend


For whole string searches this is a good deal faster than iterating through 
each and every element
of the array. 

If you are going to be working with large arrays I would caution against using 
a search class to
simplify it. There will be a potentially large speed hit in all those calls as 
the program has to
traverse the stack for each element of the array. It would be faster to search 
the array directly
instead of doing all this abstraction.

I know this doesn't solve why the program is crashing. But I think if you 
remove that abstraction
complexity it may fix the problem indirectly.

Hope that helps,
~ Tomis



--- Patrick Cusack <[EMAIL PROTECTED]> wrote:

> I created a class for searching an array. My find method iterates  
> through the array.
> 
>    dim i, max as integer
> 
>    max = ubound(objsource)
> 
> 
>    for i = 0 to max
>      if search(objsource(i)) then
>        objdest.append objsource(i)
>      end if
>    next
> 
> 
> I created an event "SEARCH" that compares a casted object's property  
> against a term that I want to search for:
> 
>    if adrrecord(obj1).character = self.stringtofind then
>      return true
>    else
>      return false
>    end if
> 
> 
> My  program crashes on the second successful search, when the  
> objsource(i) gets appended to the objdest.array. Does anyone have any  
> insight into this crash??


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to