Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-01-2009
Member
 
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?
Reply With Quote
  #2  
Old 12-01-2009
Member
 
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.
Reply With Quote
  #3  
Old 12-01-2009
Member
 
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).
Reply With Quote
  #4  
Old 12-01-2009
Member
 
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.
Reply With Quote
  #5  
Old 12-01-2009
Member
 
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.
Reply With Quote
  #6  
Old 12-01-2009
Member
 
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "VB script - GOTO Do Loop - possible to acheive?"
Thread Thread Starter Forum Replies Last Post
Excel Macro to loop a script JFN Software Development 1 27-04-2010 10:06 AM
Java - goto or continue Miles Runner Software Development 5 16-01-2010 10:47 AM
How to Acheive Windows Recovery through DVD Jamaima Operating Systems 3 02-03-2009 11:14 AM
Help with sh script loop counting Brake Fail Software Development 3 10-01-2009 06:48 PM
How to create a script in a DOS batch file to do a loop? Jon Osborn Windows Server Help 2 27-05-2008 06:41 PM


All times are GMT +5.5. The time now is 09:57 AM.