Write the vb script for the lowest and highest values of an
array?
Answer Posted / pramod mallick
Dim x(5)
x(0) = 1
x(1) = 3
x(2) = 3
x(3) = 5
x(4) = 2
Dim y
Dim strArray
'Display
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next
MsgBox "Before Sorting " & strArray
Dim z
'Demo loop
For z = LBound(x) To UBound(x)
For y = LBound(x) To UBound(x) - 1
Dim lower As Integer
Dim higher As Integer
If x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
ElseIf x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
Else 'equal
'do nothing
End If
Next
Next
'Display
strArray = ""
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next
MsgBox "After sorting " & strArray
msgbox "Lowest is " & Lbound(x) & "Highest is " Ubound(x)
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Hi, While recording a Jave based web application, its recording all my actions and the objects.And I have 5 WebEdit objects on the page and all are recorded. But while execution, at the 2 WebEdit object, its entering the value into the object (Its making a call to the AJAX, matching the value), when the control get out of this object the value is erased or cleared. Could anyone please help. I have recoreded 5 more scenarios where WebEdit is in the picture on different webpages and all are working fine. Here is my Script: Browser("Sign In").Page("Matching Workbench_3").WebEdit ("locationLookup").Set "0320 - SEATTLE-KM" Browser("Sign In").Page("Matching Workbench_3").WebEdit ("supplierNameLookup").Set "TRAMMO PETROLEUM INC" *** SupplierNameLookup is the object, which is haing an issue. And also I was using the SendString function, but it didnt work.
I want to capture data(using keyword) from msdos application using QTP?... Below is little work i could do on it... /* Set app=CreateObject("Wscript.shell") SystemUtil.run ("C:\Users\Agent\Desktop\pumpsim\PUMPSIM.EXE") Window(“PUMPSIM.EXE”).Activate wait(3) app.sendkeys "N" */ Thanks in advance...!!!
Name the different types of recording modes?
Which advantages helping QTP to hold the position of "Market Leader" for such a long period?
How to do the scripting. Is there any inbuilt functions in qtp as in qtp-s. What's the difference between them? How to handle script issues?
If I give some thousand tests to execute in two days what do you do?
How you debug your script?
I am a new tester that needs to create an automatic script involving security questions. On a webpage I need to select a security question(which are random) from a drop down menu, and then input the answer as the last word from the security question. I have the script set-up to automatically select the first security question from the drop down. The problem I am having is trying to insert the security answer. How do I insert the security answer based on the selection from the security question?
How many types of run modes are there in qtp?
regular expression in qtp standar check point for months from accepting months from january to december only
whare exactly we have to use functions and sub routain
How do you capture tooltip using QTP?
What is the limitation to XML Checkpoints?
What kinds of security (firewalls, encryptions, passwords, etc.) will be required and what is it expected to do? How can it be tested?
What is the syntax to call one script from another?