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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 42

Assisted Solution

sedgwick earned 1000 total points
ID: 39188969
LVL 42

Expert Comment

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

764 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