Good day !! I want to sort the values of the array in vb6. Here's the sample of an array that i want to sort

arr() = {21,2,33,"c","a"}

is it possible to sort an array with values of string and integer.** If not**, is it ok if you specify how to sort the array above on vb6 language.

Thank you,
- Jeff -

To have an array of mixed data types, you'll have to use the generic Object type. To sort them you'll need to make your own algorithm. Here's one that you might be able to use.

If the input are all integer was this sorting ok?

Anyway just skip with my first comment. lol

How to sort array with string values? Can you give me a sample vb6 code for that.

Thanks,
- Jeff -

The code in the link in my post should work fine, just change the type of the array to string.

the code was too long.
is there any alternative for me to understand the sorting?

Thanks,

  • Jeff -

That poat I linked to contains 3 different sub routines. One of them is an insertion sort that is only 13 lines. If that is too long, I'm afraid you need to study more about sorting and what is required to make an algorithm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.