Re: Olaf Schmidt - sort routine

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Steve Gerrard" <mynamehere@xxxxxxxxxxx> wrote in message
news:w-CdnXuSB-uoLIjbnZ2dnUVZ_qyjnZ2d@xxxxxxxxxxxxxx

"MP" <NoSpam@xxxxxxxxxx> wrote in message
news:OYhD%23i8dHHA.5056@xxxxxxxxxxxxxxxxxxxxxxx
I pasted the following code into an empty class module and named it
cSortStrings.

I bet you didn't try more than 555 strings, because K(0).Items will
return only
the first 555 (MaxSubItems). Your SortedList property won't work reliably.

The array inside the class is usually going to be bigger than the number
of
items, so use the Count property to tell you how many slots are actually
filled.

The simplest approach would be to try
For i = 0 to cSort.Count
ListBox1.AddItem cSort.Item$(i)
Next i


Thanks Steve,
Right, I have actually a very small set of strings in the app I'm using this
in now.(very simple in-house utility)
I'm such an idiot, I saw the item and count properties and was just too
stupid to see the obvious simple way you show above.
Thanks
Mark


.



Relevant Pages

  • Re: convert nested for loop to recursion
    ... then a number of suggestions for design changes ... Identify the simplest possible instance of the generalized problem. ... Express the top-level problem as an instance of the generalized one. ... and a is the array. ...
    (comp.lang.java.programmer)
  • Re: speeding up adjust-array?
    ... - Why does adjust-array take so long? ... For the ones that are bigger just how much bigger are they? ... Set a reasonable starting size that avoids the need for reallocation ... A good scheme in many cases is to double the size of the array each time. ...
    (comp.lang.lisp)
  • Re: divide and conquer
    ... > Please help me regarding a problem in Divide and conquer approach ... > in that array first N numbers are in sorted order.... ... Take a bigger step. ... Twice as big. ...
    (comp.programming)
  • Re: array notation
    ... bigger and better idiot-proof programs, and the Universe trying to produce ... bigger and better idiots. ... So far, the Universe is winning. ... > array with three elements. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to allocate memory in c#
    ... use a generic collection such as List. ... private BMyArray; ... I guess my code is wrong here, anyhow this is the functionality that I want.(being able to let the array grow bigger, define exactly how much bigger, and not to "lose" what I had before). ...
    (microsoft.public.dotnet.framework.windowsforms)