GoTo 
Author Message
 GoTo

Is there an equivalent of GoTo in VBS ?
and are there labels ?

So that one can write:

If var = x then goto Label1
elseif var = y then goto Label2
else goto label3
end if



Mon, 15 Jul 2002 03:00:00 GMT  
 GoTo
There is no GoTo in VBS (except On Error GoTo 0).

  If var = x Then
    'Label1 code
  ElseIf var = y Then
    'Label2 code
  Else
    'Label3 code
  End If

== OR ==

  Sub Label1
    'Label1 code
  End Sub
  Sub Label2
    'Label2 code
  End Sub
  Sub Label2
    'Label3 code
  End Sub

  If var = x Then
    Label1
  ElseIf var = y Then
    Label2
  Else
    Label3
  End If

=-=-=
Steve
-=-=-


Quote:
> Is there an equivalent of GoTo in VBS ?
> and are there labels ?

> So that one can write:

> If var = x then goto Label1
> elseif var = y then goto Label2
> else goto label3
> end if



Mon, 15 Jul 2002 03:00:00 GMT  
 GoTo
Hello,

Maybe Select Case would do (although I personally prefer GOTO);

Description
Executes one of several groups of statements, depending on the value of an
expression.
Syntax
Select Case testexpression
    [Case expressionlist-n
        [statements-n]] . . .
    [Case Else expressionlist-n
        [elsestatements-n]]
End Select
The Select Case statement syntax has these parts:

Regards,
Armand, FTSB


Quote:
> Is there an equivalent of GoTo in VBS ?
> and are there labels ?

> So that one can write:

> If var = x then goto Label1
> elseif var = y then goto Label2
> else goto label3
> end if



Mon, 15 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. GOTO A RECORD

2. Goto Line in module

3. GOTO a spedific record in a subform

4. Newbie: Goto Next/New Record in VBA

5. goto last record in subform

6. On Error GoTo isn't working

7. Goto Specific Line in Visual Basic

8. General OnError...Goto?

9. Problem with GoTo Statement

10. On error Goto causes error in compilation

11. How to finish off duplicate code with a goto

12. how pass argument to a goto label

 

 
Powered by phpBB® Forum Software