Micro Focus QTP (UFT) Forums
Confused in dot net arraylist - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Confused in dot net arraylist (/Thread-Confused-in-dot-net-arraylist)



Confused in dot net arraylist - pradeep singh - 11-27-2012

Hi to All,

Today I am struck in below problem.I have a scenario similar to below as given ,I have to add number in dotnet arraylist and then sort it . When I execute the below code,it does not show me the desired result.Could anybody help me in this regard?

' **************Below is my code***********
Code:
Set Mylist=DotnetFactory.CreateInstance("System.Collections.ArrayList")

MyList.add("110714")
MyList.add("110790")
MyList.add("110914")
MyList.add("110915")
MyList.add("110933")
MyList.add("14403")
MyList.add("14618")
MyList.add("14619")
MyList.add("14620")
MyList.add("14925")
MyList.add("245534")
Mylist.sort



For q=0 To Mylist.count -1
print Mylist.item(cint(q))
Next

'********************************

'****Actual result is coming************
110714
110790
110914
110915
110933
14403
14618
14619
14620
14925
245534
'**********************************


'**************My expected result***********
14403
14618
14619
14620
14925
110714
110790
110914
110915
110933
245534
'***********************************


RE: Confused in dot net arraylist - pradeep singh - 12-03-2012

Any reply on above thread?