VB.net sort an array

Posted on 2013-05-22
Medium Priority
Last Modified: 2013-05-22

I declared the following array:  Dim arrIntegers(1000) as integer

It holds a list of arrays that re not in order.

I need to sort the  numbers held in the array into descending order

and then loop through these in that order.

How would I do that?
Question by:Murray Brown
  • 2
LVL 42

Assisted Solution

by:Meir Rivkin
Meir Rivkin earned 1000 total points
ID: 39188969
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39188971
U need:
import System.Linq
LVL 86

Accepted Solution

Mike Tomlinson earned 1000 total points
ID: 39189069
You can also just use the shared Array.Sort() and Array.Reverse() methods:
        Dim arrIntegers(1000) As Integer


        For i As Integer = 0 To arrIntegers.GetUpperBound(0)
            Debug.Print(i & " = " & arrIntegers(i))

Open in new window


Author Closing Comment

by:Murray Brown
ID: 39189086
Thanks very much

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question