Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6168873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:45:44+00:00 2026-05-23T22:45:44+00:00

I am trying to create an array or a list where I can put

  • 0

I am trying to create an array or a list where I can put a numeric value together with a string and sort it by the numeric value. I understand how to sort the list. What I can’t figure out is how to put the two values together in a container where I can work with them.

The code below produces results like this

  1. 0 / 11
  2. 112.312579750842 / 15
  3. 2.218114802558 / 16
  4. 416.368892799685 / 19
  5. 97.820969866657 / 24

Obviously the ArrayList is treating everything like a string so I am not able to sort these results numerically. What can I use in place of an ArrayList to get to where I need to be?

    Dim myLong As String = "-56.5896612"
    Dim myLat As String = "23.2266818"
    Dim Results As New Generic.Dictionary(Of String, Double)
    Dim row As DataRow

    For Each row In BO.DAC.ExecuteDataTable("GeoLocationSelect").Rows
        Dim miles As Double = (Radius.CalcDistance(myLat, _
                                                  myLong, _
                                                  CStr(row("Lat")), _
                                                  CStr(row("Lon"))))
        Results.Add(String.Format("{0} / {1}", miles, row("Store")))
    Next

    ' Updated. I added this below code, which i lifted from the link Brain2000
    ' posted. I do see my key pair in the debugger listing out correctly but
    ' I am unsure of how to get a hold of them now.

    Dim sortedDict = _
    (From entry In Results Order By entry.Value Ascending).ToDictionary(Function(pair) pair.Key, _
                                                                        Function(pair) pair.Value)

    For Each res In sortedDict
    ' How do I get to the values here (for instance to write that key value pair out to the debug windows).
    Next
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:45:46+00:00Added an answer on May 23, 2026 at 10:45 pm

    A SortedDictionary or Linq should do the trick. This was discussed in more detail in the following question:

    How do you sort a dictionary by value?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an array of functions so I can call one
I'm trying to create a really simple to do list using an array and
I am trying to create a multi dimensional array using this syntax: $x[1] =
I'm trying to create a custom JSP tag that would take an array object
I was trying to create a pseudo super struct to print array of structs.
I'm trying to create a function which takes an array as an argument, adds
I'm trying to create a Quicksort base class using VB.NET, taking it an array
A little advise please. I am trying to create a tree out of following
I am trying to sort an array that contains numbers that range in substantial
I am trying to create a list of numbers and letters in order from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.