930 likes | 951 Views
VB Script. VB Script Data Types. VB Script Data Types. VB Script doesn’t support explicit declaration of data types. Only data type of VB script is Variant (Dim) Example Dim a a= “Hyderabad” --- --- --- --- a= 1234 ----- --- -- A=10.25 etc…. VB Script Data Types. Dim Val
E N D
VB Script VB Scripting
VB Script Data Types MANUAL TESTING
VB Script Data Types VB Script doesn’t support explicit declaration of data types. Only data type of VB script is Variant (Dim) Example Dim a a= “Hyderabad” --- --- --- --- a= 1234 ----- --- -- A=10.25 etc… MANUAL TESTING
VB Script Data Types Dim Val Msgbox Vartype(Val) ‘0 for empty or Uninitialized Val=“Pradeep” Msgbox Vartype(Val) ‘8 for String Msgbox Vartype(“Arun”) ‘8 for String Msgbox Vartype(“123”) ‘8 for String Msgbox Vartype(100) ‘2 for Integer Msgbox Vartype(10.12) ‘5 for Double Msgbox Vartype(#10/10/2015#) ‘7 for Date Set a = CreateObject(“Scripting.FileSystemObject”) Msgbox Vartype(a) ‘9 for Automation Objects MANUAL TESTING
VB Script Data Types Dim a,b,c a=10 b=3 c=a+b Msgbox c ‘13 a=“10” b=3 c=a+b Msgbox c ‘13 a=“10” b=“3” c=a+b Msgbox c ‘103 MANUAL TESTING
VB Script Data Types Dim a,b,c a=“Hyderabad” b=“123” c=a+b Msgbox c ‘Hyderabad123 a=“Hydera” b=“bad” c=a+b Msgbox c ‘Hyderabad a=“Hyderabad” b=3 c=a+b Msgbox c ‘Error MANUAL TESTING
Get 2 numbers Find which is big number.Also verify if any alphabets are present say as only Numbers should be given as Input.Also check if there is any Blank data say that “Blank Value, Please enter a value” Dim a,b a=InputBox(“Enter A Value”) b=InputBox(“Enter B Value”) If a<>”” And b<>”” Then If IsNumeric(a)= True And IsNumeric(b)= True Then If Cint (a) > Cint(b) Then Msgbox “A is bigger Number” Else Msgbox “A is bigger Number” End If Else Msgbox “Only Numbers should be provided as Input” End If Else Msgbox “Blank Value, Please enter a value” End If MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Functions MANUAL TESTING
Conditional Statements MANUAL TESTING
Conditional Statements • If Statements: • Executes the set of code when condition is TRUE • If…. THEN … Else • Use the If...Then...Else statement if you want to • Execute some code if a condition is true • Select one of two blocks of code to execute • If…. THEN … ElseIf • You can use the If...Then...ElseIf statement if you want to execute many blocks of code. MANUAL TESTING
DO LOOP Statement MANUAL TESTING
DO WHILE LOOP Statement MANUAL TESTING
DO UNTIL LOOP Statement MANUAL TESTING
EXIT DO WHILE LOOP Statement MANUAL TESTING
EXIT DO WHILE LOOP Statement MANUAL TESTING
WHILE WEND Statement MANUAL TESTING
WHILE WEND Statement MANUAL TESTING
WHITH Statement MANUAL TESTING
Looping Statements MANUAL TESTING
Looping Statements MANUAL TESTING
Looping Statements MANUAL TESTING
FOR NEXT Loop Statements MANUAL TESTING
EXIT FOR Loop Statements MANUAL TESTING
FOR EACH Loop Statements MANUAL TESTING
IF … THEN… ELSE Loop Statements MANUAL TESTING
IF … THEN… ELSE Loop Statements MANUAL TESTING
IF … ELSEIF Loop Statements MANUAL TESTING