On Tue, Feb 16, 2010 at 2:50 PM, Kyley Harris <ky...@harrissoftware.com> wrote: > interesting >> if Longint(Result) = LB_ERR then Error(SListIndexError, Index); > it would seem that the error is not in delphi at all. Well.. they are simply > raising the Windows error which say that -1 is the error result for a bad > index access from windows. if delphi were to ignore this error and you asked > for the value at index[99] which was out of bounds and you got -1 instead of > an error I think there would be the same number of complaints from the other > side. > Clearly its the windows API that considers -1 invalid.. not delphi.
The API help says: "The return value is the value associated with the item, or LB_ERR if an error occurs." All that says is that if an error occurs, LB_ERR (-1) will be returned. The reverse, that -1 indicates an error, does not logically follow. If you want to know whether an error occurred or not, GetLastError is the way to do it. Cheers, Karl _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe