0

The input :

i = 768
arrayInt(i) = 258
arrayIntCombine(i) = 256
arrayByte(i) = 32

i = 1632
arrayInt(i) = 256
arrayIntCombine(i) = 112
arrayByte(i) = 97

i = 1824
arrayInt(i) = 259
arrayIntCombine(i) = 32
arrayByte(i) = 112

i = 1889
arrayInt(i) = 257
arrayIntCombine(i) = 97
arrayByte(i) = 112

i = 2016
arrayInt(i) = 260
arrayIntCombine(i) = 256
arrayByte(i) = 110

..... (more input)

I would like an output like this (text or messagebox):

No. 256 : 112 and 97
No. 257 : 97 and 112
No. 258 : 256 and 32
No. 259 : 32 and 112
No. 260 : 256 and 110
...... (more output)

I've tried array.sort from Sorting an array numerically (VB.NET) but it doesnt work

1 Answer 1

0

You could use Tuples:

    Dim DictionaryOfTuples As New Dictionary(Of Integer, Tuple(Of Integer, Integer, Integer))
    DictionaryOfTuples(768) =
        New Tuple(Of Integer, Integer, Integer)(258, 256, 32)
    DictionaryOfTuples(1632) =
        New Tuple(Of Integer, Integer, Integer)(256, 112, 97)
    DictionaryOfTuples(1824) =
        New Tuple(Of Integer, Integer, Integer)(259, 32, 112)
    DictionaryOfTuples(1889) =
        New Tuple(Of Integer, Integer, Integer)(257, 97, 112)
    DictionaryOfTuples(2016) =
        New Tuple(Of Integer, Integer, Integer)(260, 256, 110)

    Dim output As New System.Text.StringBuilder
    For Each sortedTuple In DictionaryOfTuples.Values.OrderBy(Function(t) t.Item1)
        output.AppendLine(
            String.Format(
                "No. {0} : {1} and {2}",
                sortedTuple.Item1,
                sortedTuple.Item2,
                sortedTuple.Item3))
    Next

    MsgBox(output.ToString)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.