If this is what the OP is looking for then I would suggest that they may
consider implementing a class for this functionality which may set a highest
value property each time an element is set. This way one can be sure to
retreive it in the fastest time possible, rather than iterating through all
the elements.
This of course could be counter productive as it adds more processing time
to setting the elements in the first place, its a matter of judging which
operation is done most frequently, the search or the setting ? Some
impirical data may be collected in order to assess the impact or both
methods and choose whichever is most appropriate for this need.
HTH
--
OHM ( Terry Burns )
http://TrainingOn.net
"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Jan" <(E-Mail Removed)> schrieb:
>> Is there a fast way to get the highest value from an array?
>>
>> I've got the array strStorage(intCounter)
>
> \\\
> MsgBox(CStr(GetMax(1, 3, 6, 2, -5, 99, 2, 3)))
> MsgBox(CStr(GetMax(New Integer() {1, 3, 6, 2, -5, 99, 2, 3})))
> .
> .
> .
> Private Function GetMax( _
> ByVal ParamArray Items() As Integer _
> ) As Integer
> GetMax = Integer.MinValue
> For Each Item As Integer In Items
> If Item > GetMax Then
> GetMax = Item
> End If
> Next Item
> End Function
> ///
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>