Results 1 to 6 of 6

Thread: VB script - GOTO Do Loop - possible to acheive?

  1. #1
    Join Date
    Dec 2008
    Posts
    35

    VB script - GOTO Do Loop - possible to acheive?

    Hi Programming Gurus.

    I tried to do a new way of looping, that even after an exit, the loop can be entered again, without having to copy the whole do...loop area.

    I've been googling on this, but nothing really worked out.People tell me it's not possible, but that's hard to believe.

    Is it possible to enter a loop after exiting it?

  2. #2
    Join Date
    Apr 2008
    Posts
    193

    Re: VB script - GOTO Do Loop - possible to acheive?

    Hi friend,

    I would suggest that the loop would be a point where the loop starts right before your do loop that you want to re-enter. If the written code does not work for your situation, then go for a Goto Loop because eventhough it is seems very easy but its working is quite complicated,since it provides more then one entrance to a loop on a flowchart.

  3. #3
    Join Date
    Oct 2008
    Posts
    167

    Re: VB script - GOTO Do Loop - possible to acheive?

    I provide some little more information about the looping concept

    There is a way in VB - I assume it works in VBS also.

    msgbox "Begin"

    if err.description <> nothing goto Errorhandler

    msgbox "No error"

    exit function

    Errorhandler :

    msgbox "Error Handled"

    This would take you to the Errorhandler, when there has been an error,

    otherwise it won't go to the sub. (Obviously, change to if err.description

    =nothing goto Errorhandler to test functionality).

  4. #4
    Join Date
    Dec 2008
    Posts
    35

    Re: VB script - GOTO Do Loop - possible to acheive?

    That's a good idea.
    I suppose this is been used for bigger project, but I just needed a goto do-loop fast, for a few simple lines of script.

    Thanks for the tip.

  5. #5
    Join Date
    Oct 2008
    Posts
    33

    Re: VB script - GOTO Do Loop - possible to acheive?

    There is no good reason for wanting a goto (except exceptions that need on
    error as said before in VBScript) against existing code flow instructions.

    You can use
    Do [while loop]
    Exit Do
    Loop [until condition satisfies]

    Select Case
    do Case
    Case Else
    End Select

    If Then
    ElseIf Then
    Else
    End If

    These all above loops also provides the same purpose.

  6. #6
    Join Date
    Mar 2008
    Posts
    258

    Re: VB script - GOTO Do Loop - possible to acheive?

    You may also get the relevant information about the VB Script from the MSDN library just have a look at the following link.

    http://msdn.microsoft.com/en-us/library/t0aew7h6.aspx

Similar Threads

  1. Excel Macro to loop a script
    By JFN in forum Software Development
    Replies: 1
    Last Post: 27-04-2010, 10:06 AM
  2. Java - goto or continue
    By Miles Runner in forum Software Development
    Replies: 5
    Last Post: 16-01-2010, 10:47 AM
  3. How to Acheive Windows Recovery through DVD
    By Jamaima in forum Operating Systems
    Replies: 3
    Last Post: 02-03-2009, 11:14 AM
  4. Help with sh script loop counting
    By Brake Fail in forum Software Development
    Replies: 3
    Last Post: 10-01-2009, 06:48 PM
  5. How to create a script in a DOS batch file to do a loop?
    By Jon Osborn in forum Windows Server Help
    Replies: 2
    Last Post: 27-05-2008, 06:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,258,957.73745 seconds with 17 queries