Help skipping around in VB - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Help skipping around in VB (/Thread-Help-skipping-around-in-VB) |
Help skipping around in VB - Brian.Osborne - 07-20-2016 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 RE: Help skipping around in VB - Ankur - 07-23-2016 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. |