dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2018
    Posts
    2

    [RESOLVED] On x GoTo s1, s2, s3, s4

    Hello.
    Iīm trying to translate a code to Java but itīs a long time ago that I worked with Basic.
    In this (simplified) code, I have something like

    Code:
     Private Sub Form_Load()
     
     x = 5
     Debug.Print "---------------"
     
     On x GoTo s1, s2, s3, s4
    s1:
     Debug.Print 11
    s2:
     Debug.Print 22
    s3:
     Debug.Print 33
    s4:
     Debug.Print 44
    s5:
     Debug.Print 55
     
     End Sub
    When I write x = 0, it will print in the immediate window
    11 22 33 44 55
    When I write x = 1, 11 22 33 44 55
    When I write x = 2, 22 33 44 55
    When I write x = 3, 33 44 55
    When I write x = 4, 44 55
    When I write x = 5, 11 22 33 44 55

    When I reverse the order of the labels in the on GoTo line everything changes.
    What are the rules here? I canīt find anything in the reference.
    Thanks in advance,
    Emmanuel

  2. #2
    Join Date
    Feb 2018
    Posts
    2

    Re: On x GoTo s1, s2, s3, s4


  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,210

    Re: On x GoTo s1, s2, s3, s4

    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.7.1)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)