Sunday, February 22, 2009

Create List Box in VB script

Hi All,
JUST COPY PASTE BELLOW CODE IN QTP AND EXECUTE ....
Function Create_List_Dialog(Title, message, List)
On Error Resume Next
msg = message
for i = lbound(List) to ubound (List)
newmess = msg & vbCrLf & cstr(i + 1) & " - " & List(i)
msg = newmess
next
flag = 0
do while flag = 0
Ret = InputBox(msg,Title,"1")
Ret = CInt(Ret)
Create_List_Dialog = List(Ret-1)
flag = 1
If Create_List_Dialog = "" Then
flag = 1
End if
Loop
End Function

'USAGE of the above code:
domains = Array("Yahoo Mail","G Mail","Rediff Mail","Hot Mail","Sify Mail","EXITFROMTEST")
OUTPUT = Create_List_Dialog("MAIL LOGIN", "SELECT APPLICATION", domains)
msgbox OUTPUT
'Find the Output of the above code:

No comments:

Post a Comment