Student Mode Code Display

Welcome to the Fraternity!

Commenting has been enabled. You can comment on all the Code Items now.

Array Sorting Using Dot Net Factory


Add This Code to My Favourite List
Enter Email

Contributed By admin
Date 2014-09-16 02:52:31

'Advantage of using this is no addition
'code is to be written or no need to care 
'about which sorting algorithm to use
'Very efficient way to Sort an Array

'Use of ArrayList to Sort Array using Dot Net 
'Factory Class
'Pre-Requisite: Dot Net Framework should be 
'Installed.
'Class name: "System.Collections.ArrayList"
'MSDN Reference Link:
'http://msdn.microsoft.com/en-us/library/8k6e334t(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2
Dim oDotNetFactArray, Temp1
Set oDotNetFactArray = CreateObject("System.Collections.ArrayList")

' Whenever a New Item is added, it gets added as the last Element
oDotNetFactArray.Add("X")
oDotNetFactArray.Add("Y")
oDotNetFactArray.Add("G")
oDotNetFactArray.Add("H")
oDotNetFactArray.Add("A")


'THis code will not work in VBA Excel macro
oDotNetFactArray.Sort()


For Each Temp1 In oDotNetFactArray
    MsgBox Temp1
Next

'OUTPUT
'A -> G -> H -> X ->Y

Download Above Code

Comments:



Add your comments...
Name : *      
Email : *      
The content of this field will be kept private and will not be shown publicly

Your Comment/Answer *

Enter the text present in this box : *