GET WHETHER THE GIVE NUMBER VALID OR NOT IN BETWEEN THE
GIVEN RANGE?IN VB SCRIPT(QTP)

Answers were Sorted based on User's Feedback



GET WHETHER THE GIVE NUMBER VALID OR NOT IN BETWEEN THE GIVEN RANGE?IN VB SCRIPT(QTP)..

Answer / guest

Function ValidInteger(sNumber, iMin, iMax)
Dim iNumber
' Is it a number?
If IsNumeric(sNumber) Then
' Is it an integer?
If InStr(sNumber,".") = 0 Then
' Is it in the correct range?
If CLng(sNumber) >= iMin And CLng(sNumber) <= iMax Then
ValidInteger = "Valid Number Thank You"
Else
ValidInteger = "You must enter an integer between " & iMin &
" and " & iMax
End If
Else
ValidInteger = "You must enter a whole number"
End If
Else
ValidInteger = "You must enter a number"
End If
End Function
msgbox ValidInteger(9, 1, 10)

Is This Answer Correct ?    5 Yes 2 No

GET WHETHER THE GIVE NUMBER VALID OR NOT IN BETWEEN THE GIVEN RANGE?IN VB SCRIPT(QTP)..

Answer / arun

'the above code was not working fine so i modified that

Validinteger 20,1,100


Function ValidInteger(sNumber, iMin, iMax)
Dim iNumber
' Is it a number?
If IsNumeric(sNumber) Then
' Is it an integer?
If InStr(sNumber,".") = 0 Then
' Is it in the correct range?
If CLng(sNumber) >= iMin And CLng(sNumber) <= iMax Then
msgbox "Valid Number Thank You"
Else
msgbox "You must enter an integer between " & iMin &" and " & iMax
End If
Else
msgbox "You must enter a whole number"
End If
Else
msgbox "You must enter a number"
End If
End Function

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More QTP Interview Questions

How to handle the exceptions using recovery secnario manager in Qtp?

2 Answers  


what is main difference between QTP 8.2 AND QTP 9.0/9.2 HOME PAGE?i mean what are extra thing in QTP 9.0 than in QTP 8.2?

1 Answers   Infosys,


What are the types of environment variables in qtp?

0 Answers  


How many types of recording modes are there?

0 Answers  


how to use the regular expression for the below code-- swf("application name").swftreeview ("Treename").select"Medication;Pharmacy:56" There is a tree view window of the folder's ie Medication- >Pharmacy(sub folder)with 56 as count of records...The records can be different or if no records present in the specific folder..then it show "Paharmacy:-no records".Whe i record at the first time .....and try to rerun the same script with different records count say "pharmacy:800"..qtp is not regnizing it...therefore i want to user regular expression..but donot now how to use it and where to use...i have tried.... swf("application name").swftreeview ("Treename").select"Medication;Pharmacy:\*"..but it s of no use..plz help..me

0 Answers  






w is descriptive programming

2 Answers   TCS,


How many test scripts are prapare in ur project(HeathCare Insurance).

1 Answers   Virtusa,


pls tell me different type of automation frame works in QTP and which one need to select in client server application

7 Answers   Syntel,


. Types of properties that Quick Test learns while recording?

2 Answers  


write a vb script to print even numbers from 1-50?

6 Answers   Kclink Technologies, Logica CMG,


write a function to read the items from Combobox of Flight Reservation application and save in excel.

5 Answers  


-->IF two TextBOxes are there in a "Form". -->A table contains some records which contains usernames & password.. -->What is the script we need to write using Descriptive programming concept...in QTP (simply DATA DRIVEN TEST SCRIPT OF QTP)?

3 Answers   CTS,


Categories