Micro Focus QTP (UFT) Forums
program for sorting - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: program for sorting (/Thread-program-for-sorting)



program for sorting - aparna_baishya - 03-26-2008

I have to check whether the items in a listbox is in sorted order or not..can anyone please write the VB code for me..the items consist alphabets and numbers..its sorting on the basis of ascii values..


RE: program for sorting - Ankur - 04-06-2008

Have you tried this by yourself? If yes, post the tried code then members here can help.


RE: program for sorting - Anshoo Arora - 05-11-2008

Aparna, this is a simple function that will retrieve all values from a list object and enumerate them in QTP's print log:

Code:
Public Function getListValues(strWebListDesc,creationT)

    strBrowser = "creationtime:=" & creationT
    strPage = "micclass:=Page"

    Count = Browser(strBrowser).Page(strPage).WebList(strWebListDesc).GetROProperty ("items count")

    iCount = 1
        
    Do while iCount < Count    
        Browser(strBrowser).Page(strPage).WebList(strWebListDesc).Select "#" & iCount
        sListVal = Browser(strBrowser).Page(strPage).WebList(strWebListDesc).GetROProperty ("selection")
        Print sListVal 'Temporary placeholder
        iCount = iCount + 1    
    Loop    
    
End Function

Usage: Call TestWebListValue("name:=loc","")

You can test this exact code here: https://www.google.com/accounts/NewAccount?service=mail&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-10cc6f1defdd4fb09eaf42d0691b2a68-73b080130bf64eaae4a2efec47031d8db36101cb&type=2