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

WHAT IS THE USE OF "FUNCTION GENERATOR" IN QTP?

9 Answers   CTS,


what is Supplemental Objects ?

0 Answers  


hi in real time who will execute the qtp test scripts? my faculty said, in a companty automation testers are written the test scripts and manual testers are execute the test scripts...IS IT RIGHT OR NOT?

2 Answers  


What is the difference between property and method?

2 Answers  


can anybody give me the links for vb script material

1 Answers  


How does QTP identifies the object in the application?

1 Answers   Crea,


Which MS Excel formulas are possible to use in the DataTable? I am searching a formula for searching a field in the datatable

3 Answers   HP,


what is the difference between the modular framework and datadriven frame work

0 Answers  


Write a script to verify font style and color of a windows object using descriptive programming

0 Answers  


Among the 4 capture levels, Complete, Partial, Minimal, None. which one is mostly used?

1 Answers  


How you are developing the script? Using record and play back or manual?

0 Answers  


What are the advantages of parameterization ?

0 Answers  


Categories