Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help skipping around in VB
#1
Not Solved
I'm trying to figure out a way to skip around my scripts based on a variable value.

Say I want to skip to line 149 if something happens in line 4

Is there anything like this available in VB?

ex.

line 1    Call Step1
line 2    Call Step2
line 3    Call Step3
line 4    Call Step4
line 5    Call Step5

Public Func_Step1()
    If then
    Else
        Go to line 3 'this would skip step 2 if something happened.
    End If
End Function

Public Func_Step2()
    If then
    Else
        Go to line 5 'this would skip step 3 and 4 if something happened.
    End If
End Function

I could handle it with a global variable and an if statement around each function call, but I'd rather not add all that code.

any suggestions would help.

thanks,
Brian
Reply
#2
Not Solved
As far as I know there is no alternative to goto command in VBScript which we find in other languages. 

As a workaround, just create those chunk of codes as separate functions/actions and call them from required places. This way they will be maintainable as well as won't bloat your code repository.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)